Refactor the defcube macro to start the body with the splated props

This commit is contained in:
Sameer Rahmani 2023-06-10 22:47:07 +01:00
parent d65037f57f
commit fa0c5765eb
Signed by: lxsameer
GPG Key ID: B0A4AF28AB9FD90B
39 changed files with 364 additions and 410 deletions

View File

@ -27,9 +27,9 @@
(defcube fg42/agda-cube (defcube fg42/agda-cube
"Integrate Agda-mode with Fg42" "Integrate Agda-mode with Fg42"
(:title "Agda cube" :title "Agda cube"
:flag-default t :flag-default t
:flag agda) :flag agda
(load-file (load-file
(let* ((coding-system-for-read 'utf-8) (let* ((coding-system-for-read 'utf-8)
(home (getenv "HOME")) (home (getenv "HOME"))

View File

@ -26,9 +26,9 @@
(defcube fg42/flycheck-cube (defcube fg42/flycheck-cube
"This cube adds the `flycheck' support to fg42." "This cube adds the `flycheck' support to fg42."
(:title "Flycheck cube" :title "Flycheck cube"
:flag flycheck :flag flycheck
:flag-default t) :flag-default t
(fpkg/use flycheck (fpkg/use flycheck
:defer () :defer ()
:init :init
@ -37,16 +37,16 @@
(defcube fg42/yaml-cube (defcube fg42/yaml-cube
"Yaml Support" "Yaml Support"
(:title "Yaml Support" :title "Yaml Support"
:no-flag t) :no-flag t
(fpkg/use yaml-mode)) (fpkg/use yaml-mode))
(defcube fg42/lsp-cube (defcube fg42/lsp-cube
"LSP cube" "LSP cube"
(:title "LSP cube" :title "LSP cube"
:flag lsp :flag lsp
:flag-default t) :flag-default t
(fpkg/use lsp-mode (fpkg/use lsp-mode
:commands lsp :commands lsp
@ -66,9 +66,9 @@
(defcube fg42/company-cube (defcube fg42/company-cube
"Auto complete using company mode" "Auto complete using company mode"
(:title "Company cube" :title "Company cube"
:flag company :flag company
:flag-default t) :flag-default t
(fpkg/use company (fpkg/use company
:bind (:map company-active-map :bind (:map company-active-map

View File

@ -31,9 +31,9 @@
(defcube fg42/bookmark-cube (defcube fg42/bookmark-cube
"bookmark cube" "bookmark cube"
(:title "cubes/fg42/bookmark-cube.org" :title "cubes/fg42/bookmark-cube.org"
:flag bookmark :flag bookmark
:flag-default t) :flag-default t
(let* ((bnext (or (plist-get fg42/bookmark-cube-params :bm-next-key) "M-]")) (let* ((bnext (or (plist-get fg42/bookmark-cube-params :bm-next-key) "M-]"))
(bprev (or (plist-get fg42/bookmark-cube-params :bm-previous-key) "M-[")) (bprev (or (plist-get fg42/bookmark-cube-params :bm-previous-key) "M-["))

View File

@ -31,9 +31,9 @@
"Clojure support cube for fg42. "Clojure support cube for fg42.
Installs and activates clojure-mode, cider, paredit and rainbow-delimiters. Installs and activates clojure-mode, cider, paredit and rainbow-delimiters.
Also activates LSP and converts `fn` to λ." Also activates LSP and converts `fn` to λ."
(:title "Clojure cube" :title "Clojure cube"
:flag clojure :flag clojure
:flag-default t) :flag-default t
(fpkg/use aggressive-indent-mode (fpkg/use aggressive-indent-mode
:config (paredit-mode +1)) :config (paredit-mode +1))

View File

@ -27,9 +27,9 @@
(defcube fg42/cmake-cube (defcube fg42/cmake-cube
"This cube enables CMake integration with FG42" "This cube enables CMake integration with FG42"
(:title "CMake cube" :title "CMake cube"
:flag-default t :flag-default t
:flag cmake) :flag cmake
(fpkg/use cmake-mode) (fpkg/use cmake-mode)
(fpkg/use eldoc-cmake)) (fpkg/use eldoc-cmake))
@ -39,16 +39,17 @@
(defcube fg42/ninja-cube (defcube fg42/ninja-cube
"This cube enables Ninja integration with FG42. For more info checkout: "This cube enables Ninja integration with FG42. For more info checkout:
https://github.com/ninja-build/ninja/blob/master/misc/ninja-mode.el" https://github.com/ninja-build/ninja/blob/master/misc/ninja-mode.el"
(:title "Ninja cube" :title "Ninja cube"
:flag-default t :flag-default t
:flag ninja) :flag ninja
(fpkg/use ninja-mode)) (fpkg/use ninja-mode))
(defcube fg42/c++-cube (defcube fg42/c++-cube
"C++ cube" "C++ cube"
(:title "C++ cube" :title "C++ cube"
:no-flag t) :no-flag t
(fg42/cmake-cube) (fg42/cmake-cube)
(fg42/ninja-cube) (fg42/ninja-cube)
(add-to-list 'auto-mode-alist '("\\.h\\'" . c++-mode)) (add-to-list 'auto-mode-alist '("\\.h\\'" . c++-mode))

View File

@ -41,9 +41,9 @@
"This cube install ~origami~ which let you collapse and expand regions of text. "This cube install ~origami~ which let you collapse and expand regions of text.
For more info checkout [[https://github.com/gregsexton/origami.el]]" For more info checkout [[https://github.com/gregsexton/origami.el]]"
(:title "Folding cube" :title "Folding cube"
:flag folding :flag folding
:flag-default t) :flag-default t
(fpkg/use origami (fpkg/use origami
:bind :bind
(("C-c TAB" . origami-toggle-node)) (("C-c TAB" . origami-toggle-node))
@ -89,9 +89,9 @@ contextual information."
(defcube fg42/pinentry-cube (defcube fg42/pinentry-cube
"Pinentry cube with setup the =pinentry= program to be used within FG42." "Pinentry cube with setup the =pinentry= program to be used within FG42."
(:title "Pinentry cube" :title "Pinentry cube"
:flag pinentry :flag pinentry
:flag-default t) :flag-default t
(fpkg/use pinentry (fpkg/use pinentry
:init :init
(progn (progn
@ -101,9 +101,9 @@ contextual information."
(defcube fg42/imenu-cube (defcube fg42/imenu-cube
"Imenu support" "Imenu support"
(:title "Imenu cube" :title "Imenu cube"
:flag imenu :flag imenu
:flag-default t) :flag-default t
(fpkg/use imenu-list (fpkg/use imenu-list
:init :init
(global-set-key (kbd "C-'") #'imenu-list-smart-toggle))) (global-set-key (kbd "C-'") #'imenu-list-smart-toggle)))
@ -111,34 +111,34 @@ contextual information."
(defcube fg42/alert-cube (defcube fg42/alert-cube
"alert support" "alert support"
(:title "Alert cube" :title "Alert cube"
:flag alert :flag alert
:flag-default t) :flag-default t
(fpkg/use alert)) (fpkg/use alert))
(defcube fg42/emojify-cube (defcube fg42/emojify-cube
"Adds support for emojis to *FG42*" "Adds support for emojis to *FG42*"
(:title "Emojify cube" :title "Emojify cube"
:flag emoji :flag emoji
:flag-default t) :flag-default t
(fpkg/use emojify (fpkg/use emojify
:hook (after-init . global-emojify-mode))) :hook (after-init . global-emojify-mode)))
(defcube fg42/discover-cube (defcube fg42/discover-cube
"Adds support for the [[https://github.com/mickeynp/discover.el][discover]]" "Adds support for the [[https://github.com/mickeynp/discover.el][discover]]"
(:title "Discover cube" :title "Discover cube"
:flag discover :flag discover
:flag-default t) :flag-default t
(fpkg/use discover)) (fpkg/use discover))
(defcube fg42/exec-path-cube (defcube fg42/exec-path-cube
"This cube fixes the =exec-path-from-shell= issue on MacOS." "This cube fixes the =exec-path-from-shell= issue on MacOS."
(:title "Exec path cube" :title "Exec path cube"
:flag exec-path-from-shell :flag exec-path-from-shell
:flag-default t) :flag-default t
(fpkg/use exec-path-from-shell (fpkg/use exec-path-from-shell
:init :init
(when (memq window-system '(mac ns x)) (when (memq window-system '(mac ns x))
@ -147,9 +147,9 @@ contextual information."
(defcube fg42/hl-cube (defcube fg42/hl-cube
"This cube highlight the curret line." "This cube highlight the curret line."
(:title "Current line highlight cube" :title "Current line highlight cube"
:flag hl-line :flag hl-line
:flag-default t) :flag-default t
(require 'hl-line) (require 'hl-line)
(global-hl-line-mode)) (global-hl-line-mode))
@ -160,9 +160,9 @@ such as parentheses, brackets or braces according to their depth. Each successiv
is highlighted in a different color. This makes it easy to spot matching delimiters, is highlighted in a different color. This makes it easy to spot matching delimiters,
orient yourself in the code, and tell which statements are at a given depth." orient yourself in the code, and tell which statements are at a given depth."
(:title "Rainbow Delimiters Cube" :title "Rainbow Delimiters Cube"
:flag rainbow-delimiters :flag rainbow-delimiters
:flag-default t) :flag-default t
(fpkg/use rainbow-delimiters (fpkg/use rainbow-delimiters
;; It doesn't work due to a problem/conflict in rainbow-delimiters ;; It doesn't work due to a problem/conflict in rainbow-delimiters
@ -174,9 +174,9 @@ orient yourself in the code, and tell which statements are at a given depth."
"=paredit= is a minor mode for performing structured editing of S-expression "=paredit= is a minor mode for performing structured editing of S-expression
data. The typical example of this would be Lisp or Scheme source code." data. The typical example of this would be Lisp or Scheme source code."
(:title "Paredit Cube" :title "Paredit Cube"
:flag paredit :flag paredit
:flag-default t) :flag-default t
(fpkg/use paredit (fpkg/use paredit
:hook ((emacs-lisp-mode . paredit-mode) :hook ((emacs-lisp-mode . paredit-mode)
(clojure-mode . paredit-mode) (clojure-mode . paredit-mode)
@ -185,9 +185,9 @@ data. The typical example of this would be Lisp or Scheme source code."
(defcube fg42/cursor-cube (defcube fg42/cursor-cube
"This cube controls the shape of the cursor." "This cube controls the shape of the cursor."
(:title "Cursor cube" :title "Cursor cube"
:flag cursor-type :flag cursor-type
:flag-default t) :flag-default t
(let ((ctype (or (plist-get fg42/cursor-cube-params :type) 'box)) (let ((ctype (or (plist-get fg42/cursor-cube-params :type) 'box))
(ccolor (or (plist-get fg42/cursor-cube-params :color) "#aa0000"))) (ccolor (or (plist-get fg42/cursor-cube-params :color) "#aa0000")))
@ -198,9 +198,9 @@ data. The typical example of this would be Lisp or Scheme source code."
(defcube fg42/buffer-navigation-cube (defcube fg42/buffer-navigation-cube
"This cube controls the different aspect of buffer navigation" "This cube controls the different aspect of buffer navigation"
(:title "Buffer navigation cube" :title "Buffer navigation cube"
:flag buffer-navigation :flag buffer-navigation
:flag-default t) :flag-default t
(fpkg/use avy (fpkg/use avy
:bind ("M-1" . avy-goto-word-1))) :bind ("M-1" . avy-goto-word-1)))
@ -208,9 +208,9 @@ data. The typical example of this would be Lisp or Scheme source code."
(defcube fg42/window-navigation-cube (defcube fg42/window-navigation-cube
"This cube controls the different aspect of buffer navigation" "This cube controls the different aspect of buffer navigation"
(:title "Window navigation cube" :title "Window navigation cube"
:flag window-navigation :flag window-navigation
:flag-default t) :flag-default t
(fpkg/use ace-window (fpkg/use ace-window
:bind ("C-<tab>" . ace-window))) :bind ("C-<tab>" . ace-window)))
@ -218,9 +218,9 @@ data. The typical example of this would be Lisp or Scheme source code."
(defcube fg42/font-cube (defcube fg42/font-cube
"This cube controls the font configuration of *FG42*" "This cube controls the font configuration of *FG42*"
(:title "Font Cube" :title "Font Cube"
:no-flag t :no-flag t
:flag-default t) :flag-default t
(let ((font (or (plist-get fg42/font-cube-params :font-name) (let ((font (or (plist-get fg42/font-cube-params :font-name)
"Fira Mono")) "Fira Mono"))
(size (or (plist-get fg42/font-cube-params :font-size) (size (or (plist-get fg42/font-cube-params :font-size)
@ -236,28 +236,28 @@ data. The typical example of this would be Lisp or Scheme source code."
;TODO: Replace this cube with a `theme-cube' ;TODO: Replace this cube with a `theme-cube'
(defcube fg42/dracula-theme-cube (defcube fg42/dracula-theme-cube
"Replace this with a theme cube" "Replace this with a theme cube"
(:title "Dracula theme" :title "Dracula theme"
:no-flag t :no-flag t
:ui-hook (lambda () :ui-hook (lambda ()
(fpkg/use dracula-theme (fpkg/use dracula-theme
:init :init
(fg42/setup-theme (fg42/setup-theme
(load-theme 'dracula t) (load-theme 'dracula t)
(custom-theme-set-faces (custom-theme-set-faces
'dracula 'dracula
'(match ((t (:background "#44475a")))) '(match ((t (:background "#44475a"))))
'(all-the-icons-lgreen ((t (:background "#bd93f9")))) '(all-the-icons-lgreen ((t (:background "#bd93f9"))))
'(all-the-icons-faicon ((t (:background "#bd93f9")))) '(all-the-icons-faicon ((t (:background "#bd93f9"))))
'(font-lock-comment-face ((t (:foreground "#8B9298")))) '(font-lock-comment-face ((t (:foreground "#8B9298"))))
'(font-lock-comment-delimiter-face ((t (:foreground "#5B6268"))))) '(font-lock-comment-delimiter-face ((t (:foreground "#5B6268")))))
(enable-theme 'dracula) (enable-theme 'dracula)
(set-face-attribute 'region nil :background "#888")))))) (set-face-attribute 'region nil :background "#888")))))
(defcube fg42/badwolf-theme-cube (defcube fg42/badwolf-theme-cube
"Badwolf theme cube. An Emacs port of Bad Wolf theme for Vim. "Badwolf theme cube. An Emacs port of Bad Wolf theme for Vim.
https://emacsthemes.com/themes/badwolf-theme.html" https://emacsthemes.com/themes/badwolf-theme.html"
(:title "Badwolf theme" :title "Badwolf theme"
:no-flag t) :no-flag t
(require 'fg42/themes) (require 'fg42/themes)
(fpkg/use badwolf-theme (fpkg/use badwolf-theme
@ -271,9 +271,9 @@ https://emacsthemes.com/themes/badwolf-theme.html"
(defcube fg42/selectrum-cube (defcube fg42/selectrum-cube
"This cube adds support for `selectrum' to FG42" "This cube adds support for `selectrum' to FG42"
(:title "Selectrum cube" :title "Selectrum cube"
:flag selectrum :flag selectrum
:flag-default t) :flag-default t
(fpkg/use selectrum (fpkg/use selectrum
:defer nil :defer nil
:init :init
@ -296,8 +296,8 @@ https://emacsthemes.com/themes/badwolf-theme.html"
(defcube fg42/editor-cube (defcube fg42/editor-cube
"This is a meta cube that sets up the basic functionalities of an Editor" "This is a meta cube that sets up the basic functionalities of an Editor"
(:title "Editor cube" :title "Editor cube"
:no-flag t) :no-flag t
(fpkg/use rainbow-delimiters (fpkg/use rainbow-delimiters
;; It doesn't work due to a problem/conflict in rainbow-delimiters ;; It doesn't work due to a problem/conflict in rainbow-delimiters

View File

@ -32,10 +32,10 @@
(defcube fg42/eldoc-box-cube (defcube fg42/eldoc-box-cube
"This cube sets up the =eldoc-box= system to show documentations on demand in "This cube sets up the =eldoc-box= system to show documentations on demand in
a box." a box."
(:title "Eldoc box Cube" :title "Eldoc box Cube"
:flag eldoc-box :flag eldoc-box
:flag-default t :flag-default t
:modes '(eldoc-box-hover-mode eldoc-box-hover-at-point-mode)) :modes '(eldoc-box-hover-mode eldoc-box-hover-at-point-mode)
(fpkg/use eldoc-box (fpkg/use eldoc-box
:config :config
(add-hook 'eldoc-mode-hook 'eldoc-box-hover-at-point-mode))) (add-hook 'eldoc-mode-hook 'eldoc-box-hover-at-point-mode)))

View File

@ -28,8 +28,8 @@
(defcube fg42/elisp-cube (defcube fg42/elisp-cube
"Elisp cube" "Elisp cube"
(:title "cubes/fg42/elisp-cube.org" :title "cubes/fg42/elisp-cube.org"
:no-flag t) :no-flag t
(fg42/rainbow-delimiters-cube) (fg42/rainbow-delimiters-cube)
(fg42/paredit-cube) (fg42/paredit-cube)

View File

@ -59,19 +59,19 @@
"A meta cube that contains all the cubes in the system. Calling "A meta cube that contains all the cubes in the system. Calling
This cube is enough to load everything and control what cube to execute This cube is enough to load everything and control what cube to execute
via flags." via flags."
(:title "Editor cube" :title "Editor cube"
:flag-default t :flag-default t
:flag fg42-editor-cube :flag fg42-editor-cube
:init-hook (lambda (params) :init-hook (lambda (params)
(mapc (mapc
(lambda (cube) (lambda (cube)
(when (not (string= (symbol-name cube) (when (not (string= (symbol-name cube)
"fg42/editor")) "fg42/editor"))
(let ((cube-params (plist-get (let ((cube-params (plist-get
params params
(intern (concat ":" (symbol-name cube)))))) (intern (concat ":" (symbol-name cube))))))
(eval `(funcall #',cube ,@cube-params))))) (eval `(funcall #',cube ,@cube-params)))))
fg42/available-cubes)))) fg42/available-cubes)))

View File

@ -1,68 +0,0 @@
;;; FMCubes --- The file manager cubes for FG42 -*- lexical-binding: t; -*-
;;
;; Copyright (c) 2010-2022 Sameer Rahmani & Contributors
;;
;; Author: Sameer Rahmani <lxsameer@gnu.org>
;; URL: https://devheroes.codes/FG42/FG42
;; Version: 3.0.0
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;
;;; Commentary:
;;; Code:
(require 'fpkg)
(require 'fg42/cube)
;; TODO: Move this to an autoload file
(defun fg42/dired-external-open ()
"In dired, open the file named on this line."
(interactive)
(let ((file (dired-get-filename nil t)))
(call-process "xdg-open" nil 0 nil file)))
(defcube fg42/fm-cube
"file manager"
(:title "cubes/fg42/fm-cube.org"
:flag fm
:flag-default t)
;; Linux only
;; TODO: change this to support OS X
(setq dired-listing-switches "-lFaGh1v --group-directories-first")
;; Show directories first
(setq ls-lisp-dirs-first t)
(setq dired-recursive-copies 'always)
(setq dired-recursive-deletes 'always)
(define-key dired-mode-map (kbd "E") 'fg42/dired-external-open)
(fpkg/use dired+)
(add-to-list 'dired-mode-hook
(lambda ()
(require 'dired-x)
(require 'dired-aux)))
(when-flag async
(dired-async-mode 1))
(fpkg/use dired-narrow
:bind (:map dired-mode-map
("/" . dired-narrow))))
(provide 'cubes/fm)
;;; fm.el ends here

View File

@ -36,9 +36,9 @@ and you've made some changes to the current buffer that are not commited
yet it will highlihgt them for you. yet it will highlihgt them for you.
For more info check out [[https://github.com/dgutov/diff-hl][diff-hl]] 's page." For more info check out [[https://github.com/dgutov/diff-hl][diff-hl]] 's page."
(:title "Diff Highlight Cube" :title "Diff Highlight Cube"
:flag diff-hl :flag diff-hl
:flag-default t) :flag-default t
(fpkg/use diff-hl (fpkg/use diff-hl
:init :init
@ -51,9 +51,9 @@ For more info check out [[https://github.com/dgutov/diff-hl][diff-hl]] 's page."
(defcube fg42/git-cube (defcube fg42/git-cube
"This cube integrates *git* into *FG42*." "This cube integrates *git* into *FG42*."
(:title "Git Cube" :title "Git Cube"
:flag git :flag git
:flag-default t) :flag-default t
(fpkg/use magit (fpkg/use magit
:bind (("C-x g" . magit-status))) :bind (("C-x g" . magit-status)))

View File

@ -28,9 +28,9 @@
(defcube fg42/godot-cube (defcube fg42/godot-cube
"Godot3d integration for FG42." "Godot3d integration for FG42."
(:title "Godot3d cube" :title "Godot3d cube"
:flag-default t :flag-default t
:flag godot3d) :flag godot3d
(fpkg/use gdscript-mode (fpkg/use gdscript-mode
:mode "\\.gd\\'")) :mode "\\.gd\\'"))

View File

@ -29,8 +29,8 @@
(defcube fg42/golang-cube (defcube fg42/golang-cube
"Golang support cube for fg42." "Golang support cube for fg42."
(:title "Golang cube" :flag golang :title "Golang cube" :flag golang
:flag-default t) :flag-default t
(fpkg/use go-mode (fpkg/use go-mode
:defer t :defer t

View File

@ -35,10 +35,10 @@ be able to edit =dot= files and use =C-c C-p= to see a preview of your =dot=
file. Use =C-c C-c= to compile the =dot= file. file. Use =C-c C-c= to compile the =dot= file.
If =company= flag is enabled then =dot= autocomplete will be enabled as well." If =company= flag is enabled then =dot= autocomplete will be enabled as well."
(:title "Graphviz Cube" :title "Graphviz Cube"
:flag graphviz :flag graphviz
:flag-default t :flag-default t
:modes 'graphviz-dot-mode) :modes 'graphviz-dot-mode
(let ((indent-size (or (plist-get fg42/graphviz-cube-params :indent-size) 4))) (let ((indent-size (or (plist-get fg42/graphviz-cube-params :indent-size) 4)))
(fg42/after-cubes (fg42/after-cubes

View File

@ -28,9 +28,9 @@
(defcube fg42/groovy-cube (defcube fg42/groovy-cube
"Groovy support for FG42." "Groovy support for FG42."
(:title "Groovy cube" :title "Groovy cube"
:flag groovy :flag groovy
:flag-default t) :flag-default t
(fpkg/use groovy-emacs-mode (fpkg/use groovy-emacs-mode
:defer t)) :defer t))

View File

@ -28,10 +28,9 @@
(defcube fg42/haml-cube (defcube fg42/haml-cube
"This cube provides syntax highlighting and syntax-aware indentation "This cube provides syntax highlighting and syntax-aware indentation
for haml files" for haml files"
:title "Haml Cube"
(:title "Haml Cube" :flag haml
:flag haml :flag-default t
:flag-default t)
(fpkg/use haml-mode (fpkg/use haml-mode
:mode "\\.haml\\'")) :mode "\\.haml\\'"))

View File

@ -29,9 +29,9 @@
(defcube fg42/all-the-icons-cube (defcube fg42/all-the-icons-cube
"Install the [[https://github.com/domtronn/all-the-icons.el][all-the-icons.el]] "Install the [[https://github.com/domtronn/all-the-icons.el][all-the-icons.el]]
package." package."
(:title "All the icons cube" :title "All the icons cube"
:flag all-the-icons :flag all-the-icons
:flag-default t) :flag-default t
(fpkg/use all-the-icons (fpkg/use all-the-icons
:if (display-graphic-p))) :if (display-graphic-p)))

View File

@ -27,8 +27,9 @@
(defcube fg42/rcirc-cube (defcube fg42/rcirc-cube
"IRC cube" "IRC cube"
(:title "cubes/fg42/rcirc-cube.org" :title "RCIRC Cube"
:flag rcirc) :flag rcirc
(autoload-cube 'fg42/rcirc-connect "irc/core.el" "Connect to IRC via RCIRC." t) (autoload-cube 'fg42/rcirc-connect "irc/core.el" "Connect to IRC via RCIRC." t)
(defun fg42/connect-to-irc () (defun fg42/connect-to-irc ()
(interactive) (interactive)

View File

@ -27,9 +27,9 @@
(defcube fg42/gradle-cube (defcube fg42/gradle-cube
"Gradle support" "Gradle support"
(:title "cubes/fg42/java-cube.org" :title "Gradle Cube"
:flag gradle :flag gradle
:flag-default t) :flag-default t
(fpkg/use groovy-mode (fpkg/use groovy-mode
:mode "\\.gradle\\'") :mode "\\.gradle\\'")
@ -43,9 +43,9 @@
(defcube fg42/java-cube (defcube fg42/java-cube
"Java cube" "Java cube"
(:title "cubes/fg42/java-cube.org" :title "Java Cube"
:flag java :flag java
:flag-default t) :flag-default t
(add-hook 'java-mode-hook (add-hook 'java-mode-hook
(lambda() (lambda()

View File

@ -31,9 +31,9 @@
(defcube fg42/langtool-cube (defcube fg42/langtool-cube
"A Language Server for LanguageTool with support for LaTeX, Markdown, "A Language Server for LanguageTool with support for LaTeX, Markdown,
and others. For more info checkout [[https://github.com/emacs-languagetool/lsp-ltex]]" and others. For more info checkout [[https://github.com/emacs-languagetool/lsp-ltex]]"
(:title "Language tool Cube" :title "Language tool Cube"
:flag language-tool :flag language-tool
:flag-default t) :flag-default t
(let ((user (plist-get fg42/langtool-cube-params :username)) (let ((user (plist-get fg42/langtool-cube-params :username))
(apikey (plist-get fg42/langtool-cube-params :api-key))) (apikey (plist-get fg42/langtool-cube-params :api-key)))

View File

@ -39,9 +39,9 @@ cube.
For more info on check out [[https://codeberg.org/martianh/mastodon.el]]" For more info on check out [[https://codeberg.org/martianh/mastodon.el]]"
(:title "Mastodone Cube" :title "Mastodone Cube"
:flag mastodon :flag mastodon
:flag-default nil) :flag-default nil
(let ((url (or (plist-get fg42/mastodon-cube-params :instance-url) (let ((url (or (plist-get fg42/mastodon-cube-params :instance-url)
(error "Instance url is empty set the `:instance-url' key"))) (error "Instance url is empty set the `:instance-url' key")))

View File

@ -28,9 +28,9 @@
(defcube fg42/meissa-cube (defcube fg42/meissa-cube
"Integrate FG42 with Meissa" "Integrate FG42 with Meissa"
(:title "Meissa cube" :title "Meissa cube"
:flag-default t :flag-default t
:flag meissa) :flag meissa
(fpkg/use msgpack) (fpkg/use msgpack)

View File

@ -29,9 +29,9 @@
"This cube enables support for meson build files. "This cube enables support for meson build files.
For more info checkout [[https://github.com/wentasah/meson-mode]]" For more info checkout [[https://github.com/wentasah/meson-mode]]"
(:title "Meson cube" :title "Meson cube"
:flag mesonbuild :flag mesonbuild
:flag-default t) :flag-default t
(fpkg/use meson-mode (fpkg/use meson-mode
:config :config
(progn (progn

View File

@ -33,10 +33,10 @@
;; TODO: Break this into two cubes ;; TODO: Break this into two cubes
(defcube fg42/modeline-cube (defcube fg42/modeline-cube
"Modeline cube" "Modeline cube"
(:title "Mini modeline" :title "Mini modeline"
:flag mini-mode-line :flag mini-mode-line
:group modeline :group modeline
:flag-default t) :flag-default t
(defun fg42/mini-modeline-setter (def) (defun fg42/mini-modeline-setter (def)
(if (null def) (if (null def)
@ -94,10 +94,10 @@
"Status bar replaces the default mode line aned merges with "Status bar replaces the default mode line aned merges with
the mini buffer to provide a minimal interface for displaying the mini buffer to provide a minimal interface for displaying
valuable information." valuable information."
(:title "Status bar cube" :title "Status bar cube"
:flag status-bar :flag status-bar
:group modeline :group modeline
:flag-default nil) :flag-default nil
(fg42/all-the-icons-cube) (fg42/all-the-icons-cube)

View File

@ -28,9 +28,9 @@
(defcube fg42/ednc-cube (defcube fg42/ednc-cube
"Notifications support for FG42." "Notifications support for FG42."
(:title "Notifications cube" :title "Notifications cube"
:flag ednc :flag ednc
:flag-default t) :flag-default t
(fpkg/use ednc (fpkg/use ednc
:defer t :defer t

View File

@ -50,9 +50,10 @@ be used as a backend for other tools. The libraries ~org-ql-search~ and
After installation, you can use the commands without additional configuration. After installation, you can use the commands without additional configuration.
To use the functions and macros in your own Elisp code, use libraries ~org-ql~ To use the functions and macros in your own Elisp code, use libraries ~org-ql~
and ~org-ql-view~." and ~org-ql-view~."
(:title "Org Qurey Language" :title "Org Qurey Language"
:flag org-ql :flag org-ql
:flag-default t) :flag-default t
(fpkg/use org-ql (fpkg/use org-ql
:after org)) :after org))
@ -69,9 +70,9 @@ You can set your groups via the ~:groups~ parameter. Check out the code
for more parameters. for more parameters.
For more information checkout [[https://github.com/alphapapa/org-super-agenda]]" For more information checkout [[https://github.com/alphapapa/org-super-agenda]]"
(:title "Org Super Agenda" :title "Org Super Agenda"
:flag org-super-agenda :flag org-super-agenda
:flag-default t) :flag-default t
(defconst fg42/org-super-agenda-groups (defconst fg42/org-super-agenda-groups
nil) nil)
@ -104,9 +105,9 @@ current buffer (similar to the Org agenda, but without all its features) at the
a list of all other non-done to-do items below. If the buffer is narrowed, the sidebar only a list of all other non-done to-do items below. If the buffer is narrowed, the sidebar only
shows items in the narrowed portion; this allows seeing an overview of tasks in a subtree." shows items in the narrowed portion; this allows seeing an overview of tasks in a subtree."
(:title "Org Sidebar" :title "Org Sidebar"
:flag org-sidebar :flag org-sidebar
:flag-default t) :flag-default t
(let ((default-file (or (plist-get fg42/org-sidebar-params :default-file) "~/orgs/main.org")) (let ((default-file (or (plist-get fg42/org-sidebar-params :default-file) "~/orgs/main.org"))
(fns (plist-get fg42/org-sidebar-params :sidebar-fns))) (fns (plist-get fg42/org-sidebar-params :sidebar-fns)))
@ -143,9 +144,9 @@ cubes and you can pass parameters to them via ~:super-agenda~, ~:ql~ and ~:sideb
For more info on ~org-mode~ check out [[https://orgmode.org/]]" For more info on ~org-mode~ check out [[https://orgmode.org/]]"
(:title "Org-mode" :title "Org-mode"
:flag org :flag org
:flag-default t) :flag-default t
(let ((capture-key (or (plist-get fg42/org-cube-params :capture-key) (let ((capture-key (or (plist-get fg42/org-cube-params :capture-key)
(kbd "<f6>"))) (kbd "<f6>")))

View File

@ -28,9 +28,9 @@
(defcube fg42/projectile-cube (defcube fg42/projectile-cube
"Projectile Cube" "Projectile Cube"
(:title "cubes/fg42/projectile-cube.org" :title "cubes/fg42/projectile-cube.org"
:flag projectile :flag projectile
:flag-default t) :flag-default t
(let ((project-dirs (or (plist-get fg42/projectile-cube-params :project-dirs) (let ((project-dirs (or (plist-get fg42/projectile-cube-params :project-dirs)
()))) ())))

View File

@ -28,9 +28,9 @@
(defcube fg42/proof-general-cube (defcube fg42/proof-general-cube
"Integrate Proof General with Fg42" "Integrate Proof General with Fg42"
(:title "Proof General cube" :title "Proof General cube"
:flag-default t :flag-default t
:flag proof-general) :flag proof-general
(fpkg/use proof-general) (fpkg/use proof-general)
(fpkg/use company-coq (fpkg/use company-coq

View File

@ -56,9 +56,9 @@ interactive `pyvenv-workon' function before `lsp'"
(defcube fg42/python-black-cube (defcube fg42/python-black-cube
"This cube reformats python code using black formatter tool." "This cube reformats python code using black formatter tool."
(:title "Python lang server via pyls" :title "Python lang server via pyls"
:flag python-black :flag python-black
:flag-default t) :flag-default t
(fpkg/use python-black (fpkg/use python-black
:demand t :demand t
@ -68,9 +68,9 @@ interactive `pyvenv-workon' function before `lsp'"
(defcube fg42/python-cube-pyls (defcube fg42/python-cube-pyls
"Python language server using pyls" "Python language server using pyls"
(:title "Python lang server via pyls" :title "Python lang server via pyls"
:flag python-pyls :flag python-pyls
:flag-default nil) :flag-default nil
(when-flag lsp (when-flag lsp
(with-eval-after-load "lsp" (with-eval-after-load "lsp"
@ -85,9 +85,9 @@ interactive `pyvenv-workon' function before `lsp'"
(defcube fg42/python-cube-pyright (defcube fg42/python-cube-pyright
"Python language server using pyright." "Python language server using pyright."
(:title "Python lang server via pyright" :title "Python lang server via pyright"
:flag python-pyright :flag python-pyright
:flag-default t) :flag-default t
(fpkg/use lsp-pyright (fpkg/use lsp-pyright
:ensure t :ensure t
@ -103,9 +103,10 @@ interactive `pyvenv-workon' function before `lsp'"
(defcube fg42/poetry-cube (defcube fg42/poetry-cube
"Poetry support for FG42. To use it, just use `M-x poetry'." "Poetry support for FG42. To use it, just use `M-x poetry'."
(:title "Python cube" :title "Poetry cube"
:flag poetry :flag poetry
:flag-default t) :flag-default t
(fpkg/use poetry (fpkg/use poetry
:config :config
(poetry-tracking-mode 1))) (poetry-tracking-mode 1)))
@ -113,9 +114,9 @@ interactive `pyvenv-workon' function before `lsp'"
(defcube fg42/python-cube (defcube fg42/python-cube
"Python support cube." "Python support cube."
(:title "Python cube" :title "Python cube"
:flag python :flag python
:flag-default t) :flag-default t
(fpkg/use pyvenv (fpkg/use pyvenv
:defer t :defer t

View File

@ -27,7 +27,7 @@
(defcube fg42/region-expansion-cube (defcube fg42/region-expansion-cube
"RE cube" "RE cube"
(:title "cubes/fg42/region-expansion.org") :title "Region Expansion Cube"
(fpkg/use expand-region (fpkg/use expand-region
:bind ("C-=" . er/expand-region))) :bind ("C-=" . er/expand-region)))

View File

@ -31,9 +31,9 @@ for *FG42*. Refer to *Rigel* docs to set it up.
This cube exposes few functions that interact with regel. Checkout the docstrings of This cube exposes few functions that interact with regel. Checkout the docstrings of
functions in `fg42/rigel/` namespace. For example `fg42/rigel/read` function." functions in `fg42/rigel/` namespace. For example `fg42/rigel/read` function."
(:title "rigel Cube" :title "rigel Cube"
:flag rigel :flag rigel
:flag-default t) :flag-default t
(autoload-cube (autoload-cube

View File

@ -35,10 +35,10 @@ If the =lsp= flag is set it is going to use the =rust-analyzer=
as the LSP server so it has to be installed on the host OS. as the LSP server so it has to be installed on the host OS.
For more info on check out [[https://rust-analyzer.github.io]]" For more info on check out [[https://rust-analyzer.github.io]]"
:title "Rust Cube"
:flag rust
:flag-default t
(:title "Rust Cube"
:flag rust
:flag-default t)
(fpkg/use rustic (fpkg/use rustic
:bind (:map rustic-mode-map :bind (:map rustic-mode-map
("M-j" . lsp-ui-imenu) ("M-j" . lsp-ui-imenu)

View File

@ -32,9 +32,9 @@
(defcube fg42/guile-cube (defcube fg42/guile-cube
"This cube adds supports for GNU Guile Scheme via =emacs-lsp-scheme= library. "This cube adds supports for GNU Guile Scheme via =emacs-lsp-scheme= library.
For more info checkout [[https://codeberg.org/rgherdt/emacs-lsp-scheme]]" For more info checkout [[https://codeberg.org/rgherdt/emacs-lsp-scheme]]"
(:title "Scheme Cube" :title "Scheme Cube"
:flag scheme :flag scheme
:flag-default t) :flag-default t
(fg42/rainbow-delimiters-cube) (fg42/rainbow-delimiters-cube)
(fg42/paredit-cube) (fg42/paredit-cube)

View File

@ -26,9 +26,9 @@
(defcube fg42/yasnippet-cube (defcube fg42/yasnippet-cube
"Yasnippet cube" "Yasnippet cube"
(:title "cubes/fg42/yasnippet-cube.org" :title "cubes/fg42/yasnippet-cube.org"
:flag yasnippet :flag yasnippet
:flag-default t) :flag-default t
(fpkg/use yasnippet-snippets) (fpkg/use yasnippet-snippets)

View File

@ -26,8 +26,8 @@
(defcube fg42/vterm-cube (defcube fg42/vterm-cube
"Vterm cube" "Vterm cube"
(:title "cubes/fg42/vterm-cube.org" :title "VTerm Cube"
:flag vterm) :flag vterm
(let ((_shell (or (plist-get fg42/vterm-cube-params :shell) (let ((_shell (or (plist-get fg42/vterm-cube-params :shell)
(getenv "SHELL")))) (getenv "SHELL"))))
(fpkg/use vterm (fpkg/use vterm

View File

@ -31,9 +31,9 @@
(defcube fg42/terraform-cube (defcube fg42/terraform-cube
"terraform cube" "terraform cube"
(:title "cubes/fg42/terraform-cube.org" :title "cubes/fg42/terraform-cube.org"
:flag terraform :flag terraform
:flag-default t) :flag-default t
;; https://github.com/juliosueiras/terraform-lsp is required ;; https://github.com/juliosueiras/terraform-lsp is required
(let ((terraform-lsp (or (plist-get fg42/terraform-cube-params :terraform-lsp-path) "terraform-lsp")) (let ((terraform-lsp (or (plist-get fg42/terraform-cube-params :terraform-lsp-path) "terraform-lsp"))

View File

@ -34,8 +34,8 @@
(defcube fg42/wm-cube (defcube fg42/wm-cube
"This cube will setup *FG42* to act as a window manager." "This cube will setup *FG42* to act as a window manager."
(:title "Window manager cube" :title "Window manager cube"
:no-flag t) :no-flag t
(if-flag wm (if-flag wm
(when-wm (when-wm

View File

@ -27,9 +27,9 @@
(defcube fg42/zig-cube (defcube fg42/zig-cube
"This cube integrates *zig* into *FG42*." "This cube integrates *zig* into *FG42*."
(:title "Zig Cube" :title "Zig Cube"
:flag zig :flag zig
:flag-default t) :flag-default t
(fpkg/use zig-mode (fpkg/use zig-mode
:mode ("\\.zig?\\'" . zig-mode)) :mode ("\\.zig?\\'" . zig-mode))

View File

@ -46,8 +46,24 @@ it is to use `fg42/after-cubes' macro.")
The execution happens after Emacs is initialized.") The execution happens after Emacs is initialized.")
(defmacro defcube (cube-name docs props &rest body) (defun fg42/extract-props (body-list &optional acc)
"Define a cube with the given CUBE-NAME, a list of PROPS, DOCS and a BODY." "Extract the props pairs from BODY-LIST with an optional accumulator ACC.
It will returen a pair in form of (body . props)."
(let ((k (car body-list))
(rest (cdr body-list)))
(if (and k (keywordp k))
(fg42/extract-props
(cdr rest)
(cons (cdr rest) (plist-put (cdr acc) k (car rest))))
(cons body-list (cdr acc)))))
(defmacro defcube (cube-name docs &rest props-n-body)
"Define a cube with the given CUBE-NAME, DOCS and a PROPS-N-BODY.
TODO: Docs"
(declare (indent defun) (doc-string 2)) (declare (indent defun) (doc-string 2))
;; Make sure that props is a plist and contains the `:docs' key ;; Make sure that props is a plist and contains the `:docs' key
@ -55,130 +71,133 @@ The execution happens after Emacs is initialized.")
(when (not (stringp docs)) (when (not (stringp docs))
(error "Missing docstring for '%s' cube" cube-name)) (error "Missing docstring for '%s' cube" cube-name))
(when (not (plist-get props :title)) (let* ((parsed-body (fg42/extract-props props-n-body))
(error "Missing :titel key for '%s' cube" cube-name)) (body (car parsed-body))
(props (cdr parsed-body)))
(let ((complete-props (plist-put props :docs docs)) (when (not (plist-get props :title))
(cube-name-internal (intern (format "%s-internal" cube-name))) (error "Missing :titel key for '%s' cube" cube-name))
;; prop hooks
(init-hook (plist-get props :init-hook)) (let ((complete-props (plist-put props :docs docs))
(ui-hook (plist-get props :ui-hook)) (cube-name-internal (intern (format "%s-internal" cube-name)))
;; prop hooks
(init-hook (plist-get props :init-hook))
(ui-hook (plist-get props :ui-hook))
(params-var (intern (format "%s-params" cube-name)))
(active-var (intern (format "%s-active-p" cube-name)))
(pre-lang-server-up-hook (intern (format "%s-pre-lang-server-up-hook" cube-name)))
(post-lang-server-up-hook (intern (format "%s-post-lang-server-up-hook" cube-name)))
(pre-lang-server-down-hook (intern (format "%s-pre-lang-server-down-hook" cube-name)))
(post-lang-server-down-hook (intern (format "%s-post-lang-server-down-hook" cube-name)))
(pre-init-hook (intern (format "%s-pre-init-hook" cube-name)))
(post-init-hook (intern (format "%s-post-init-hook" cube-name)))
(post-init-hook (intern (format "%s-post-init-hook" cube-name)))
(flag-var (or (plist-get props :flag) cube-name))
(flag-docstring-var (or (plist-get props :flag-doc)
(format "The flag to enable/disable the '%s' cube." cube-name)))
(flag-default (plist-get props :flag-default))
(flag-conflict (plist-get props :conflicts-with))
(no-flag? (or (plist-get props :no-flag) ())))
(add-to-list 'fg42/available-cubes cube-name)
`(progn
;; Create a new flag for each cube to control the cubes systemwide.
(when (not ,no-flag?)
(defflag ,flag-var ,flag-docstring-var ,flag-default))
;; Params variable contains the list of params the is passed to
;; the current cube call
(defvar ,params-var nil
,(format "Parameters for the '%s' cube." cube-name))
;; * Hooks
;; This hook can be used by others to run code just before running that
;; cube's body
(defvar ,pre-init-hook nil
,(format "The hook that runs befor the '%s' cube initialization." cube-name))
(params-var (intern (format "%s-params" cube-name))) ;; This hook can be used by others to run code just after the body of
(active-var (intern (format "%s-active-p" cube-name))) ;; the cube
(pre-lang-server-up-hook (intern (format "%s-pre-lang-server-up-hook" cube-name))) (defvar ,post-init-hook nil
(post-lang-server-up-hook (intern (format "%s-post-lang-server-up-hook" cube-name))) ,(format "The hook that runs after the '%s' cube initialization." cube-name))
(pre-lang-server-down-hook (intern (format "%s-pre-lang-server-down-hook" cube-name)))
(post-lang-server-down-hook (intern (format "%s-post-lang-server-down-hook" cube-name)))
(pre-init-hook (intern (format "%s-pre-init-hook" cube-name)))
(post-init-hook (intern (format "%s-post-init-hook" cube-name)))
(post-init-hook (intern (format "%s-post-init-hook" cube-name)))
(flag-var (or (plist-get props :flag) cube-name)) ;; TODO: Move language server related hooks to lang-server
(flag-docstring-var (or (plist-get props :flag-doc) ;; TODO: Provide a way to let different parts of the
(format "The flag to enable/disable the '%s' cube." cube-name))) ;; codebase to create cube hooks
(flag-default (plist-get props :flag-default))
(flag-conflict (plist-get props :conflicts-with))
(no-flag? (or (plist-get props :no-flag) ())))
(add-to-list 'fg42/available-cubes cube-name) ;; ** Language Server
;;; The hook that enables users to change the language server configuration
;;; of the current cube before activating the server
(defvar ,pre-lang-server-up-hook nil
,(format "The hook that runs befor the '%s' cube's language server activates ." cube-name))
`(progn ;;; The hook to do any post configuration for the lang server of the cube
(defvar ,post-lang-server-up-hook nil
,(format "The hook that runs after the '%s' cube's language server activates." cube-name))
;; Create a new flag for each cube to control the cubes systemwide. ;;; The hook to run code just before the language server is about to shutdown
(when (not ,no-flag?) (defvar ,pre-lang-server-down-hook nil
(defflag ,flag-var ,flag-docstring-var ,flag-default)) ,(format "The hook that runs befor the '%s' cube's language server shuts down." cube-name))
;; Params variable contains the list of params the is passed to ;;; The hook to run code after the language server successfully shuts down
;; the current cube call (defvar ,post-lang-server-down-hook nil
(defvar ,params-var nil ,(format "The hook that runs after the '%s' cube's language server shuts down." cube-name))
,(format "Parameters for the '%s' cube." cube-name))
;; * Hooks ;; This way we can bypass the flag system if we really really want to.
(defun ,cube-name-internal (params)
;; This hook can be used by others to run code just before running that (if (or (not (boundp (quote ,active-var)))
;; cube's body (not ,active-var))
(defvar ,pre-init-hook nil
,(format "The hook that runs befor the '%s' cube initialization." cube-name))
;; This hook can be used by others to run code just after the body of
;; the cube
(defvar ,post-init-hook nil
,(format "The hook that runs after the '%s' cube initialization." cube-name))
;; TODO: Move language server related hooks to lang-server
;; TODO: Provide a way to let different parts of the
;; codebase to create cube hooks
;; ** Language Server
;;; The hook that enables users to change the language server configuration
;;; of the current cube before activating the server
(defvar ,pre-lang-server-up-hook nil
,(format "The hook that runs befor the '%s' cube's language server activates ." cube-name))
;;; The hook to do any post configuration for the lang server of the cube
(defvar ,post-lang-server-up-hook nil
,(format "The hook that runs after the '%s' cube's language server activates." cube-name))
;;; The hook to run code just before the language server is about to shutdown
(defvar ,pre-lang-server-down-hook nil
,(format "The hook that runs befor the '%s' cube's language server shuts down." cube-name))
;;; The hook to run code after the language server successfully shuts down
(defvar ,post-lang-server-down-hook nil
,(format "The hook that runs after the '%s' cube's language server shuts down." cube-name))
;; This way we can bypass the flag system if we really really want to.
(defun ,cube-name-internal (params)
(if (or (not (boundp (quote ,active-var)))
(not ,active-var))
(progn
;; Mark this cube as active
(setq ,active-var t)
;; Set the parameters in CUBE-NAME-params to be accessable
;; in the body
(setq ,params-var params)
;; Run the pre init hook
(run-hooks (quote ,pre-init-hook))
(fg42/info "Initializing '%s' cube." (quote ,cube-name))
;; Run the body
(let ((result (progn ,@body)))
;; Run the post init hook
(run-hooks (quote ,post-init-hook))
result))
(fg42/info "The '%s' cube is already active." ',cube-name)))
(defun ,cube-name (&rest params)
(interactive)
(let ((ui-hook ,ui-hook)
(init-hook ,init-hook))
(if ,no-flag?
(progn (progn
(when (not (null ui-hook)) ;; Mark this cube as active
(add-hook 'fg42/ui-hook ui-hook)) (setq ,active-var t)
;; If no flag is need to control this cube
(when (not (null init-hook))
(funcall init-hook params))
(add-hook 'fg42/-cubes-body-hook (lambda ()
(,cube-name-internal params))))
;; Otherwise check for the flag to be active
(if-flag ,flag-var
(progn
(when (not (null ui-hook))
(add-hook 'fg42/ui-hook ,ui-hook))
(when (not (null init-hook))
(funcall init-hook params))
(add-hook 'fg42/-cubes-body-hook (lambda ()
(,cube-name-internal params))))
(fg42/info "The flag for '%s' cube is disabled. Skiping." ,(symbol-name cube-name))))))
;; Set the symbol-plist of the cube-name to its props ;; Set the parameters in CUBE-NAME-params to be accessable
(setplist ',cube-name ',complete-props)))) ;; in the body
(setq ,params-var params)
;; Run the pre init hook
(run-hooks (quote ,pre-init-hook))
(fg42/info "Initializing '%s' cube." (quote ,cube-name))
;; Run the body
(let ((result (progn ,@body)))
;; Run the post init hook
(run-hooks (quote ,post-init-hook))
result))
(fg42/info "The '%s' cube is already active." ',cube-name)))
(defun ,cube-name (&rest params)
(interactive)
(let ((ui-hook ,ui-hook)
(init-hook ,init-hook))
(if ,no-flag?
(progn
(when (not (null ui-hook))
(add-hook 'fg42/ui-hook ui-hook))
;; If no flag is need to control this cube
(when (not (null init-hook))
(funcall init-hook params))
(add-hook 'fg42/-cubes-body-hook (lambda ()
(,cube-name-internal params))))
;; Otherwise check for the flag to be active
(if-flag ,flag-var
(progn
(when (not (null ui-hook))
(add-hook 'fg42/ui-hook ,ui-hook))
(when (not (null init-hook))
(funcall init-hook params))
(add-hook 'fg42/-cubes-body-hook (lambda ()
(,cube-name-internal params))))
(fg42/info "The flag for '%s' cube is disabled. Skiping." ,(symbol-name cube-name))))))
;; Set the symbol-plist of the cube-name to its props
(setplist ',cube-name ',complete-props)))))
(defmacro fg42/after-cubes (&rest body) (defmacro fg42/after-cubes (&rest body)
@ -195,9 +214,9 @@ It passes the BODY to `fpkg/use'."
(declare (indent defun) (doc-string 2)) (declare (indent defun) (doc-string 2))
`(defcube ,(intern (format "fg42/%s-cube" pkg)) `(defcube ,(intern (format "fg42/%s-cube" pkg))
,docs ,docs
(:title ,(format "%s cube" pkg) :title ,(format "%s cube" pkg)
:flag ,pkg :flag ,pkg
:flag-default t) :flag-default t
(fpkg/use ,pkg ,@body))) (fpkg/use ,pkg ,@body)))