diff --git a/core/cubes/agda.el b/core/cubes/agda.el index aa3e21d..61bad7a 100644 --- a/core/cubes/agda.el +++ b/core/cubes/agda.el @@ -27,9 +27,9 @@ (defcube fg42/agda-cube "Integrate Agda-mode with Fg42" - (:title "Agda cube" - :flag-default t - :flag agda) + :title "Agda cube" + :flag-default t + :flag agda (load-file (let* ((coding-system-for-read 'utf-8) (home (getenv "HOME")) diff --git a/core/cubes/autocompletion.el b/core/cubes/autocompletion.el index 0b8ab46..573f08e 100644 --- a/core/cubes/autocompletion.el +++ b/core/cubes/autocompletion.el @@ -26,9 +26,9 @@ (defcube fg42/flycheck-cube "This cube adds the `flycheck' support to fg42." - (:title "Flycheck cube" - :flag flycheck - :flag-default t) + :title "Flycheck cube" + :flag flycheck + :flag-default t (fpkg/use flycheck :defer () :init @@ -37,16 +37,16 @@ (defcube fg42/yaml-cube "Yaml Support" - (:title "Yaml Support" - :no-flag t) + :title "Yaml Support" + :no-flag t (fpkg/use yaml-mode)) (defcube fg42/lsp-cube "LSP cube" - (:title "LSP cube" - :flag lsp - :flag-default t) + :title "LSP cube" + :flag lsp + :flag-default t (fpkg/use lsp-mode :commands lsp @@ -66,9 +66,9 @@ (defcube fg42/company-cube "Auto complete using company mode" - (:title "Company cube" - :flag company - :flag-default t) + :title "Company cube" + :flag company + :flag-default t (fpkg/use company :bind (:map company-active-map diff --git a/core/cubes/bookmark.el b/core/cubes/bookmark.el index d95191f..433cfd0 100644 --- a/core/cubes/bookmark.el +++ b/core/cubes/bookmark.el @@ -31,9 +31,9 @@ (defcube fg42/bookmark-cube "bookmark cube" - (:title "cubes/fg42/bookmark-cube.org" - :flag bookmark - :flag-default t) + :title "cubes/fg42/bookmark-cube.org" + :flag bookmark + :flag-default t (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-[")) diff --git a/core/cubes/clojure.el b/core/cubes/clojure.el index b73d6ca..7306f9e 100644 --- a/core/cubes/clojure.el +++ b/core/cubes/clojure.el @@ -31,9 +31,9 @@ "Clojure support cube for fg42. Installs and activates clojure-mode, cider, paredit and rainbow-delimiters. Also activates LSP and converts `fn` to λ." - (:title "Clojure cube" - :flag clojure - :flag-default t) + :title "Clojure cube" + :flag clojure + :flag-default t (fpkg/use aggressive-indent-mode :config (paredit-mode +1)) diff --git a/core/cubes/cpp.el b/core/cubes/cpp.el index e46775f..1289ac9 100644 --- a/core/cubes/cpp.el +++ b/core/cubes/cpp.el @@ -27,9 +27,9 @@ (defcube fg42/cmake-cube "This cube enables CMake integration with FG42" - (:title "CMake cube" - :flag-default t - :flag cmake) + :title "CMake cube" + :flag-default t + :flag cmake (fpkg/use cmake-mode) (fpkg/use eldoc-cmake)) @@ -39,16 +39,17 @@ (defcube fg42/ninja-cube "This cube enables Ninja integration with FG42. For more info checkout: https://github.com/ninja-build/ninja/blob/master/misc/ninja-mode.el" - (:title "Ninja cube" - :flag-default t - :flag ninja) + :title "Ninja cube" + :flag-default t + :flag ninja (fpkg/use ninja-mode)) (defcube fg42/c++-cube "C++ cube" - (:title "C++ cube" - :no-flag t) + :title "C++ cube" + :no-flag t + (fg42/cmake-cube) (fg42/ninja-cube) (add-to-list 'auto-mode-alist '("\\.h\\'" . c++-mode)) diff --git a/core/cubes/editor.el b/core/cubes/editor.el index e76f708..f1e93c2 100644 --- a/core/cubes/editor.el +++ b/core/cubes/editor.el @@ -41,9 +41,9 @@ "This cube install ~origami~ which let you collapse and expand regions of text. For more info checkout [[https://github.com/gregsexton/origami.el]]" - (:title "Folding cube" - :flag folding - :flag-default t) + :title "Folding cube" + :flag folding + :flag-default t (fpkg/use origami :bind (("C-c TAB" . origami-toggle-node)) @@ -89,9 +89,9 @@ contextual information." (defcube fg42/pinentry-cube "Pinentry cube with setup the =pinentry= program to be used within FG42." - (:title "Pinentry cube" - :flag pinentry - :flag-default t) + :title "Pinentry cube" + :flag pinentry + :flag-default t (fpkg/use pinentry :init (progn @@ -101,9 +101,9 @@ contextual information." (defcube fg42/imenu-cube "Imenu support" - (:title "Imenu cube" - :flag imenu - :flag-default t) + :title "Imenu cube" + :flag imenu + :flag-default t (fpkg/use imenu-list :init (global-set-key (kbd "C-'") #'imenu-list-smart-toggle))) @@ -111,34 +111,34 @@ contextual information." (defcube fg42/alert-cube "alert support" - (:title "Alert cube" - :flag alert - :flag-default t) + :title "Alert cube" + :flag alert + :flag-default t (fpkg/use alert)) (defcube fg42/emojify-cube "Adds support for emojis to *FG42*" - (:title "Emojify cube" - :flag emoji - :flag-default t) + :title "Emojify cube" + :flag emoji + :flag-default t (fpkg/use emojify :hook (after-init . global-emojify-mode))) (defcube fg42/discover-cube "Adds support for the [[https://github.com/mickeynp/discover.el][discover]]" - (:title "Discover cube" - :flag discover - :flag-default t) + :title "Discover cube" + :flag discover + :flag-default t (fpkg/use discover)) (defcube fg42/exec-path-cube "This cube fixes the =exec-path-from-shell= issue on MacOS." - (:title "Exec path cube" - :flag exec-path-from-shell - :flag-default t) + :title "Exec path cube" + :flag exec-path-from-shell + :flag-default t (fpkg/use exec-path-from-shell :init (when (memq window-system '(mac ns x)) @@ -147,9 +147,9 @@ contextual information." (defcube fg42/hl-cube "This cube highlight the curret line." - (:title "Current line highlight cube" - :flag hl-line - :flag-default t) + :title "Current line highlight cube" + :flag hl-line + :flag-default t (require 'hl-line) (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, orient yourself in the code, and tell which statements are at a given depth." - (:title "Rainbow Delimiters Cube" - :flag rainbow-delimiters - :flag-default t) + :title "Rainbow Delimiters Cube" + :flag rainbow-delimiters + :flag-default t (fpkg/use 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 data. The typical example of this would be Lisp or Scheme source code." - (:title "Paredit Cube" - :flag paredit - :flag-default t) + :title "Paredit Cube" + :flag paredit + :flag-default t (fpkg/use paredit :hook ((emacs-lisp-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 "This cube controls the shape of the cursor." - (:title "Cursor cube" - :flag cursor-type - :flag-default t) + :title "Cursor cube" + :flag cursor-type + :flag-default t (let ((ctype (or (plist-get fg42/cursor-cube-params :type) 'box)) (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 "This cube controls the different aspect of buffer navigation" - (:title "Buffer navigation cube" - :flag buffer-navigation - :flag-default t) + :title "Buffer navigation cube" + :flag buffer-navigation + :flag-default t (fpkg/use avy :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 "This cube controls the different aspect of buffer navigation" - (:title "Window navigation cube" - :flag window-navigation - :flag-default t) + :title "Window navigation cube" + :flag window-navigation + :flag-default t (fpkg/use ace-window :bind ("C-" . ace-window))) @@ -218,9 +218,9 @@ data. The typical example of this would be Lisp or Scheme source code." (defcube fg42/font-cube "This cube controls the font configuration of *FG42*" - (:title "Font Cube" - :no-flag t - :flag-default t) + :title "Font Cube" + :no-flag t + :flag-default t (let ((font (or (plist-get fg42/font-cube-params :font-name) "Fira Mono")) (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' (defcube fg42/dracula-theme-cube "Replace this with a theme cube" - (:title "Dracula theme" - :no-flag t - :ui-hook (lambda () - (fpkg/use dracula-theme - :init - (fg42/setup-theme - (load-theme 'dracula t) - (custom-theme-set-faces - 'dracula - '(match ((t (:background "#44475a")))) - '(all-the-icons-lgreen ((t (:background "#bd93f9")))) - '(all-the-icons-faicon ((t (:background "#bd93f9")))) - '(font-lock-comment-face ((t (:foreground "#8B9298")))) - '(font-lock-comment-delimiter-face ((t (:foreground "#5B6268"))))) - (enable-theme 'dracula) - (set-face-attribute 'region nil :background "#888")))))) + :title "Dracula theme" + :no-flag t + :ui-hook (lambda () + (fpkg/use dracula-theme + :init + (fg42/setup-theme + (load-theme 'dracula t) + (custom-theme-set-faces + 'dracula + '(match ((t (:background "#44475a")))) + '(all-the-icons-lgreen ((t (:background "#bd93f9")))) + '(all-the-icons-faicon ((t (:background "#bd93f9")))) + '(font-lock-comment-face ((t (:foreground "#8B9298")))) + '(font-lock-comment-delimiter-face ((t (:foreground "#5B6268"))))) + (enable-theme 'dracula) + (set-face-attribute 'region nil :background "#888"))))) (defcube fg42/badwolf-theme-cube "Badwolf theme cube. An Emacs port of Bad Wolf theme for Vim. https://emacsthemes.com/themes/badwolf-theme.html" - (:title "Badwolf theme" - :no-flag t) + :title "Badwolf theme" + :no-flag t (require 'fg42/themes) (fpkg/use badwolf-theme @@ -271,9 +271,9 @@ https://emacsthemes.com/themes/badwolf-theme.html" (defcube fg42/selectrum-cube "This cube adds support for `selectrum' to FG42" - (:title "Selectrum cube" - :flag selectrum - :flag-default t) + :title "Selectrum cube" + :flag selectrum + :flag-default t (fpkg/use selectrum :defer nil :init @@ -296,8 +296,8 @@ https://emacsthemes.com/themes/badwolf-theme.html" (defcube fg42/editor-cube "This is a meta cube that sets up the basic functionalities of an Editor" - (:title "Editor cube" - :no-flag t) + :title "Editor cube" + :no-flag t (fpkg/use rainbow-delimiters ;; It doesn't work due to a problem/conflict in rainbow-delimiters diff --git a/core/cubes/eldoc.el b/core/cubes/eldoc.el index 2d54b5c..b2b0efd 100644 --- a/core/cubes/eldoc.el +++ b/core/cubes/eldoc.el @@ -32,10 +32,10 @@ (defcube fg42/eldoc-box-cube "This cube sets up the =eldoc-box= system to show documentations on demand in a box." - (:title "Eldoc box Cube" - :flag eldoc-box - :flag-default t - :modes '(eldoc-box-hover-mode eldoc-box-hover-at-point-mode)) + :title "Eldoc box Cube" + :flag eldoc-box + :flag-default t + :modes '(eldoc-box-hover-mode eldoc-box-hover-at-point-mode) (fpkg/use eldoc-box :config (add-hook 'eldoc-mode-hook 'eldoc-box-hover-at-point-mode))) diff --git a/core/cubes/elisp.el b/core/cubes/elisp.el index a35590d..67c1ce8 100644 --- a/core/cubes/elisp.el +++ b/core/cubes/elisp.el @@ -28,8 +28,8 @@ (defcube fg42/elisp-cube "Elisp cube" - (:title "cubes/fg42/elisp-cube.org" - :no-flag t) + :title "cubes/fg42/elisp-cube.org" + :no-flag t (fg42/rainbow-delimiters-cube) (fg42/paredit-cube) diff --git a/core/cubes/fg42.el b/core/cubes/fg42.el index c86a10d..e6d6cfa 100644 --- a/core/cubes/fg42.el +++ b/core/cubes/fg42.el @@ -59,19 +59,19 @@ "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 via flags." - (:title "Editor cube" - :flag-default t - :flag fg42-editor-cube - :init-hook (lambda (params) - (mapc - (lambda (cube) - (when (not (string= (symbol-name cube) - "fg42/editor")) - (let ((cube-params (plist-get - params - (intern (concat ":" (symbol-name cube)))))) - (eval `(funcall #',cube ,@cube-params))))) - fg42/available-cubes)))) + :title "Editor cube" + :flag-default t + :flag fg42-editor-cube + :init-hook (lambda (params) + (mapc + (lambda (cube) + (when (not (string= (symbol-name cube) + "fg42/editor")) + (let ((cube-params (plist-get + params + (intern (concat ":" (symbol-name cube)))))) + (eval `(funcall #',cube ,@cube-params))))) + fg42/available-cubes))) diff --git a/core/cubes/fm.el b/core/cubes/fm.el deleted file mode 100644 index 6505866..0000000 --- a/core/cubes/fm.el +++ /dev/null @@ -1,68 +0,0 @@ -;;; FMCubes --- The file manager cubes for FG42 -*- lexical-binding: t; -*- -;; -;; Copyright (c) 2010-2022 Sameer Rahmani & Contributors -;; -;; Author: Sameer Rahmani -;; 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 . -;; -;;; 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 diff --git a/core/cubes/git.el b/core/cubes/git.el index 0367e48..371d970 100644 --- a/core/cubes/git.el +++ b/core/cubes/git.el @@ -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. For more info check out [[https://github.com/dgutov/diff-hl][diff-hl]] 's page." - (:title "Diff Highlight Cube" - :flag diff-hl - :flag-default t) + :title "Diff Highlight Cube" + :flag diff-hl + :flag-default t (fpkg/use diff-hl :init @@ -51,9 +51,9 @@ For more info check out [[https://github.com/dgutov/diff-hl][diff-hl]] 's page." (defcube fg42/git-cube "This cube integrates *git* into *FG42*." - (:title "Git Cube" - :flag git - :flag-default t) + :title "Git Cube" + :flag git + :flag-default t (fpkg/use magit :bind (("C-x g" . magit-status))) diff --git a/core/cubes/godot3d.el b/core/cubes/godot3d.el index 8b4d74d..057d289 100644 --- a/core/cubes/godot3d.el +++ b/core/cubes/godot3d.el @@ -28,9 +28,9 @@ (defcube fg42/godot-cube "Godot3d integration for FG42." - (:title "Godot3d cube" - :flag-default t - :flag godot3d) + :title "Godot3d cube" + :flag-default t + :flag godot3d (fpkg/use gdscript-mode :mode "\\.gd\\'")) diff --git a/core/cubes/golang.el b/core/cubes/golang.el index 76d41c2..9e4de03 100644 --- a/core/cubes/golang.el +++ b/core/cubes/golang.el @@ -29,8 +29,8 @@ (defcube fg42/golang-cube "Golang support cube for fg42." - (:title "Golang cube" :flag golang - :flag-default t) + :title "Golang cube" :flag golang + :flag-default t (fpkg/use go-mode :defer t diff --git a/core/cubes/graph.el b/core/cubes/graph.el index 3bad0c9..9b2002d 100644 --- a/core/cubes/graph.el +++ b/core/cubes/graph.el @@ -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. If =company= flag is enabled then =dot= autocomplete will be enabled as well." - (:title "Graphviz Cube" - :flag graphviz - :flag-default t - :modes 'graphviz-dot-mode) + :title "Graphviz Cube" + :flag graphviz + :flag-default t + :modes 'graphviz-dot-mode (let ((indent-size (or (plist-get fg42/graphviz-cube-params :indent-size) 4))) (fg42/after-cubes diff --git a/core/cubes/groovy.el b/core/cubes/groovy.el index 6d97da0..b51878b 100644 --- a/core/cubes/groovy.el +++ b/core/cubes/groovy.el @@ -28,9 +28,9 @@ (defcube fg42/groovy-cube "Groovy support for FG42." - (:title "Groovy cube" - :flag groovy - :flag-default t) + :title "Groovy cube" + :flag groovy + :flag-default t (fpkg/use groovy-emacs-mode :defer t)) diff --git a/core/cubes/haml.el b/core/cubes/haml.el index 6fb30e3..6f498af 100644 --- a/core/cubes/haml.el +++ b/core/cubes/haml.el @@ -28,10 +28,9 @@ (defcube fg42/haml-cube "This cube provides syntax highlighting and syntax-aware indentation for haml files" - - (:title "Haml Cube" - :flag haml - :flag-default t) + :title "Haml Cube" + :flag haml + :flag-default t (fpkg/use haml-mode :mode "\\.haml\\'")) diff --git a/core/cubes/icons.el b/core/cubes/icons.el index 6c9c30e..358cbc7 100644 --- a/core/cubes/icons.el +++ b/core/cubes/icons.el @@ -29,9 +29,9 @@ (defcube fg42/all-the-icons-cube "Install the [[https://github.com/domtronn/all-the-icons.el][all-the-icons.el]] package." - (:title "All the icons cube" - :flag all-the-icons - :flag-default t) + :title "All the icons cube" + :flag all-the-icons + :flag-default t (fpkg/use all-the-icons :if (display-graphic-p))) diff --git a/core/cubes/irc.el b/core/cubes/irc.el index 7be3834..da72064 100644 --- a/core/cubes/irc.el +++ b/core/cubes/irc.el @@ -27,8 +27,9 @@ (defcube fg42/rcirc-cube "IRC cube" - (:title "cubes/fg42/rcirc-cube.org" - :flag rcirc) + :title "RCIRC Cube" + :flag rcirc + (autoload-cube 'fg42/rcirc-connect "irc/core.el" "Connect to IRC via RCIRC." t) (defun fg42/connect-to-irc () (interactive) diff --git a/core/cubes/java.el b/core/cubes/java.el index 3135e23..9dfa5e8 100644 --- a/core/cubes/java.el +++ b/core/cubes/java.el @@ -27,9 +27,9 @@ (defcube fg42/gradle-cube "Gradle support" - (:title "cubes/fg42/java-cube.org" - :flag gradle - :flag-default t) + :title "Gradle Cube" + :flag gradle + :flag-default t (fpkg/use groovy-mode :mode "\\.gradle\\'") @@ -43,9 +43,9 @@ (defcube fg42/java-cube "Java cube" - (:title "cubes/fg42/java-cube.org" - :flag java - :flag-default t) + :title "Java Cube" + :flag java + :flag-default t (add-hook 'java-mode-hook (lambda() diff --git a/core/cubes/langtool.el b/core/cubes/langtool.el index 4f06e40..031692f 100644 --- a/core/cubes/langtool.el +++ b/core/cubes/langtool.el @@ -31,9 +31,9 @@ (defcube fg42/langtool-cube "A Language Server for LanguageTool with support for LaTeX, Markdown, and others. For more info checkout [[https://github.com/emacs-languagetool/lsp-ltex]]" - (:title "Language tool Cube" - :flag language-tool - :flag-default t) + :title "Language tool Cube" + :flag language-tool + :flag-default t (let ((user (plist-get fg42/langtool-cube-params :username)) (apikey (plist-get fg42/langtool-cube-params :api-key))) diff --git a/core/cubes/mastodon.el b/core/cubes/mastodon.el index aaf7e80..cb4cde8 100644 --- a/core/cubes/mastodon.el +++ b/core/cubes/mastodon.el @@ -39,9 +39,9 @@ cube. For more info on check out [[https://codeberg.org/martianh/mastodon.el]]" - (:title "Mastodone Cube" - :flag mastodon - :flag-default nil) + :title "Mastodone Cube" + :flag mastodon + :flag-default nil (let ((url (or (plist-get fg42/mastodon-cube-params :instance-url) (error "Instance url is empty set the `:instance-url' key"))) diff --git a/core/cubes/meissa.el b/core/cubes/meissa.el index 85568da..957ab47 100644 --- a/core/cubes/meissa.el +++ b/core/cubes/meissa.el @@ -28,9 +28,9 @@ (defcube fg42/meissa-cube "Integrate FG42 with Meissa" - (:title "Meissa cube" - :flag-default t - :flag meissa) + :title "Meissa cube" + :flag-default t + :flag meissa (fpkg/use msgpack) diff --git a/core/cubes/meson.el b/core/cubes/meson.el index c0f57e6..5e40358 100644 --- a/core/cubes/meson.el +++ b/core/cubes/meson.el @@ -29,9 +29,9 @@ "This cube enables support for meson build files. For more info checkout [[https://github.com/wentasah/meson-mode]]" - (:title "Meson cube" - :flag mesonbuild - :flag-default t) + :title "Meson cube" + :flag mesonbuild + :flag-default t (fpkg/use meson-mode :config (progn diff --git a/core/cubes/modeline.el b/core/cubes/modeline.el index bb6da9b..7e5ca7f 100644 --- a/core/cubes/modeline.el +++ b/core/cubes/modeline.el @@ -33,10 +33,10 @@ ;; TODO: Break this into two cubes (defcube fg42/modeline-cube "Modeline cube" - (:title "Mini modeline" - :flag mini-mode-line - :group modeline - :flag-default t) + :title "Mini modeline" + :flag mini-mode-line + :group modeline + :flag-default t (defun fg42/mini-modeline-setter (def) (if (null def) @@ -94,10 +94,10 @@ "Status bar replaces the default mode line aned merges with the mini buffer to provide a minimal interface for displaying valuable information." - (:title "Status bar cube" - :flag status-bar - :group modeline - :flag-default nil) + :title "Status bar cube" + :flag status-bar + :group modeline + :flag-default nil (fg42/all-the-icons-cube) diff --git a/core/cubes/notifications.el b/core/cubes/notifications.el index 243b5e4..7b1a7b8 100644 --- a/core/cubes/notifications.el +++ b/core/cubes/notifications.el @@ -28,9 +28,9 @@ (defcube fg42/ednc-cube "Notifications support for FG42." - (:title "Notifications cube" - :flag ednc - :flag-default t) + :title "Notifications cube" + :flag ednc + :flag-default t (fpkg/use ednc :defer t diff --git a/core/cubes/org.el b/core/cubes/org.el index 0e81c41..93e50ae 100644 --- a/core/cubes/org.el +++ b/core/cubes/org.el @@ -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. To use the functions and macros in your own Elisp code, use libraries ~org-ql~ and ~org-ql-view~." - (:title "Org Qurey Language" - :flag org-ql - :flag-default t) + :title "Org Qurey Language" + :flag org-ql + :flag-default t + (fpkg/use org-ql :after org)) @@ -69,9 +70,9 @@ You can set your groups via the ~:groups~ parameter. Check out the code for more parameters. For more information checkout [[https://github.com/alphapapa/org-super-agenda]]" - (:title "Org Super Agenda" - :flag org-super-agenda - :flag-default t) + :title "Org Super Agenda" + :flag org-super-agenda + :flag-default t (defconst fg42/org-super-agenda-groups 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 shows items in the narrowed portion; this allows seeing an overview of tasks in a subtree." - (:title "Org Sidebar" - :flag org-sidebar - :flag-default t) + :title "Org Sidebar" + :flag org-sidebar + :flag-default t (let ((default-file (or (plist-get fg42/org-sidebar-params :default-file) "~/orgs/main.org")) (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/]]" - (:title "Org-mode" - :flag org - :flag-default t) + :title "Org-mode" + :flag org + :flag-default t (let ((capture-key (or (plist-get fg42/org-cube-params :capture-key) (kbd ""))) diff --git a/core/cubes/project.el b/core/cubes/project.el index 08b6966..77c4ac6 100644 --- a/core/cubes/project.el +++ b/core/cubes/project.el @@ -28,9 +28,9 @@ (defcube fg42/projectile-cube "Projectile Cube" - (:title "cubes/fg42/projectile-cube.org" - :flag projectile - :flag-default t) + :title "cubes/fg42/projectile-cube.org" + :flag projectile + :flag-default t (let ((project-dirs (or (plist-get fg42/projectile-cube-params :project-dirs) ()))) diff --git a/core/cubes/proof.el b/core/cubes/proof.el index 641c1cc..555c60d 100644 --- a/core/cubes/proof.el +++ b/core/cubes/proof.el @@ -28,9 +28,9 @@ (defcube fg42/proof-general-cube "Integrate Proof General with Fg42" - (:title "Proof General cube" - :flag-default t - :flag proof-general) + :title "Proof General cube" + :flag-default t + :flag proof-general (fpkg/use proof-general) (fpkg/use company-coq diff --git a/core/cubes/python.el b/core/cubes/python.el index e37cf9c..f03d7d2 100644 --- a/core/cubes/python.el +++ b/core/cubes/python.el @@ -56,9 +56,9 @@ interactive `pyvenv-workon' function before `lsp'" (defcube fg42/python-black-cube "This cube reformats python code using black formatter tool." - (:title "Python lang server via pyls" - :flag python-black - :flag-default t) + :title "Python lang server via pyls" + :flag python-black + :flag-default t (fpkg/use python-black :demand t @@ -68,9 +68,9 @@ interactive `pyvenv-workon' function before `lsp'" (defcube fg42/python-cube-pyls "Python language server using pyls" - (:title "Python lang server via pyls" - :flag python-pyls - :flag-default nil) + :title "Python lang server via pyls" + :flag python-pyls + :flag-default nil (when-flag lsp (with-eval-after-load "lsp" @@ -85,9 +85,9 @@ interactive `pyvenv-workon' function before `lsp'" (defcube fg42/python-cube-pyright "Python language server using pyright." - (:title "Python lang server via pyright" - :flag python-pyright - :flag-default t) + :title "Python lang server via pyright" + :flag python-pyright + :flag-default t (fpkg/use lsp-pyright :ensure t @@ -103,9 +103,10 @@ interactive `pyvenv-workon' function before `lsp'" (defcube fg42/poetry-cube "Poetry support for FG42. To use it, just use `M-x poetry'." - (:title "Python cube" - :flag poetry - :flag-default t) + :title "Poetry cube" + :flag poetry + :flag-default t + (fpkg/use poetry :config (poetry-tracking-mode 1))) @@ -113,9 +114,9 @@ interactive `pyvenv-workon' function before `lsp'" (defcube fg42/python-cube "Python support cube." - (:title "Python cube" - :flag python - :flag-default t) + :title "Python cube" + :flag python + :flag-default t (fpkg/use pyvenv :defer t diff --git a/core/cubes/region-expansion.el b/core/cubes/region-expansion.el index adbefd3..3de910d 100644 --- a/core/cubes/region-expansion.el +++ b/core/cubes/region-expansion.el @@ -27,7 +27,7 @@ (defcube fg42/region-expansion-cube "RE cube" - (:title "cubes/fg42/region-expansion.org") + :title "Region Expansion Cube" (fpkg/use expand-region :bind ("C-=" . er/expand-region))) diff --git a/core/cubes/rigel.el b/core/cubes/rigel.el index f5f0d87..2681021 100644 --- a/core/cubes/rigel.el +++ b/core/cubes/rigel.el @@ -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 functions in `fg42/rigel/` namespace. For example `fg42/rigel/read` function." - (:title "rigel Cube" - :flag rigel - :flag-default t) + :title "rigel Cube" + :flag rigel + :flag-default t (autoload-cube diff --git a/core/cubes/rust.el b/core/cubes/rust.el index 34db6f7..1553563 100644 --- a/core/cubes/rust.el +++ b/core/cubes/rust.el @@ -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. 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 :bind (:map rustic-mode-map ("M-j" . lsp-ui-imenu) diff --git a/core/cubes/scheme.el b/core/cubes/scheme.el index 03f3958..2865143 100644 --- a/core/cubes/scheme.el +++ b/core/cubes/scheme.el @@ -32,9 +32,9 @@ (defcube fg42/guile-cube "This cube adds supports for GNU Guile Scheme via =emacs-lsp-scheme= library. For more info checkout [[https://codeberg.org/rgherdt/emacs-lsp-scheme]]" - (:title "Scheme Cube" - :flag scheme - :flag-default t) + :title "Scheme Cube" + :flag scheme + :flag-default t (fg42/rainbow-delimiters-cube) (fg42/paredit-cube) diff --git a/core/cubes/snippets.el b/core/cubes/snippets.el index c0e8241..99960ca 100644 --- a/core/cubes/snippets.el +++ b/core/cubes/snippets.el @@ -26,9 +26,9 @@ (defcube fg42/yasnippet-cube "Yasnippet cube" - (:title "cubes/fg42/yasnippet-cube.org" - :flag yasnippet - :flag-default t) + :title "cubes/fg42/yasnippet-cube.org" + :flag yasnippet + :flag-default t (fpkg/use yasnippet-snippets) diff --git a/core/cubes/terminal.el b/core/cubes/terminal.el index 872218a..3e1b0b4 100644 --- a/core/cubes/terminal.el +++ b/core/cubes/terminal.el @@ -26,8 +26,8 @@ (defcube fg42/vterm-cube "Vterm cube" - (:title "cubes/fg42/vterm-cube.org" - :flag vterm) + :title "VTerm Cube" + :flag vterm (let ((_shell (or (plist-get fg42/vterm-cube-params :shell) (getenv "SHELL")))) (fpkg/use vterm diff --git a/core/cubes/terraform.el b/core/cubes/terraform.el index 86b96f3..c1f6fa7 100644 --- a/core/cubes/terraform.el +++ b/core/cubes/terraform.el @@ -31,9 +31,9 @@ (defcube fg42/terraform-cube "terraform cube" - (:title "cubes/fg42/terraform-cube.org" - :flag terraform - :flag-default t) + :title "cubes/fg42/terraform-cube.org" + :flag terraform + :flag-default t ;; https://github.com/juliosueiras/terraform-lsp is required (let ((terraform-lsp (or (plist-get fg42/terraform-cube-params :terraform-lsp-path) "terraform-lsp")) diff --git a/core/cubes/wm.el b/core/cubes/wm.el index 4e755ab..6a7788b 100644 --- a/core/cubes/wm.el +++ b/core/cubes/wm.el @@ -34,8 +34,8 @@ (defcube fg42/wm-cube "This cube will setup *FG42* to act as a window manager." - (:title "Window manager cube" - :no-flag t) + :title "Window manager cube" + :no-flag t (if-flag wm (when-wm diff --git a/core/cubes/zig.el b/core/cubes/zig.el index 065a2fa..bb397bb 100644 --- a/core/cubes/zig.el +++ b/core/cubes/zig.el @@ -27,9 +27,9 @@ (defcube fg42/zig-cube "This cube integrates *zig* into *FG42*." - (:title "Zig Cube" - :flag zig - :flag-default t) + :title "Zig Cube" + :flag zig + :flag-default t (fpkg/use zig-mode :mode ("\\.zig?\\'" . zig-mode)) diff --git a/core/fg42/cube.el b/core/fg42/cube.el index ceed05e..b18866c 100644 --- a/core/fg42/cube.el +++ b/core/fg42/cube.el @@ -46,8 +46,24 @@ it is to use `fg42/after-cubes' macro.") The execution happens after Emacs is initialized.") -(defmacro defcube (cube-name docs props &rest body) - "Define a cube with the given CUBE-NAME, a list of PROPS, DOCS and a BODY." +(defun fg42/extract-props (body-list &optional acc) + "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)) ;; 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)) (error "Missing docstring for '%s' cube" cube-name)) - (when (not (plist-get props :title)) - (error "Missing :titel key for '%s' cube" cube-name)) + (let* ((parsed-body (fg42/extract-props props-n-body)) + (body (car parsed-body)) + (props (cdr parsed-body))) - (let ((complete-props (plist-put props :docs docs)) - (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)) + (when (not (plist-get props :title)) + (error "Missing :titel key for '%s' cube" cube-name)) + + (let ((complete-props (plist-put props :docs docs)) + (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))) - (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))) + ;; 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)) - (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) ()))) + ;; TODO: Move language server related hooks to lang-server + ;; TODO: Provide a way to let different parts of the + ;; codebase to create cube hooks - (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. - (when (not ,no-flag?) - (defflag ,flag-var ,flag-docstring-var ,flag-default)) + ;;; 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)) - ;; 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)) + ;;; 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)) - ;; * 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)) - - - ;; 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? + ;; 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 - (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)))))) + ;; Mark this cube as active + (setq ,active-var t) - ;; Set the symbol-plist of the cube-name to its props - (setplist ',cube-name ',complete-props)))) + ;; 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 + (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) @@ -195,9 +214,9 @@ 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) + :title ,(format "%s cube" pkg) + :flag ,pkg + :flag-default t (fpkg/use ,pkg ,@body)))