diff --git a/build.el b/build.el index c246e93..0e5716c 100755 --- a/build.el +++ b/build.el @@ -81,7 +81,7 @@ PARAMS: ((string= commad "compile") (do-command (native-compile-async fg42/CORE_DIR 'recursively) - (native-compile-async "~/.fg42.v3.el") + (native-compile-async "~/.fg42.el") (print "Compiling FG42 files ...") (while (or comp-files-queue diff --git a/config/fg42.user.el b/config/fg42.user.el index f41fea0..f4d0898 100644 --- a/config/fg42.user.el +++ b/config/fg42.user.el @@ -1,29 +1,6 @@ ;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*- ;; -;; Copyright (c) 2010-2020 Sameer Rahmani -;; -;; Author: Sameer Rahmani -;; URL: https://gitlab.com/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: -;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*- -;; -;; Copyright (c) 2010-2020 Sameer Rahmani +;; Copyright (c) 2010-2023 Sameer Rahmani ;; ;; Author: Sameer Rahmani ;; URL: https://gitlab.com/FG42/FG42 @@ -49,49 +26,13 @@ ;; (setq debug-on-error t) (require 'fg42/flags) -(require 'cubes/editor) -(require 'cubes/org) -(require 'cubes/elisp) -(require 'cubes/region-expansion) -(require 'cubes/wm) -(require 'cubes/modeline) -(require 'cubes/autocompletion) -(require 'cubes/golang) -(require 'cubes/project) -(require 'cubes/irc) -(require 'cubes/terminal) -(require 'cubes/java) -(require 'cubes/python) -(require 'cubes/cpp) -(require 'cubes/snippets) - -(require 'cubes/git) -(require 'cubes/bookmark) -(require 'cubes/terraform) -(require 'cubes/graph) -(require 'cubes/clojure) - +(require 'cubes/fg42) (defvar global-font-size 12) -(custom-set-faces - '(mini-modeline-mode-line - ((((background light)) - :background "#aa0000" :height 0.1 :box nil) - (t - :background "#bd93f9" :height 0.1 :box nil)))) - - (use-flags (fg42/merge-with-default-flags wm - python - golang - rcirc - vterm - company - lsp - flycheck fg42/region-expansion-cube)) @@ -106,39 +47,22 @@ :background "#6272a4" :height 0.1 :box nil)))) (fg42/wm-cube :number-of-workspaces 9) + ;; Uncomment the following section if need a easy way to control the resolution ;; Change the resolution and monitors to your need - (defvar monitors - '(:hdmi-only - ("--output HDMI-1 --primary" - "--output eDP-1 --off") - :hdmi-main - ("--output HDMI-1 --primary" - "--output eDP-1 --mode 1920x1080 --left-of HDMI-1") - :edp-only - ("--output eDP-1 --mode 1920x1080" - "--output HDMI-1 --off"))) - - (require 'seq) - (defun monitor-profiles () - (mapcar - #'car - (seq-partition monitors 2))) - - (defun monitor (mon) - (interactive - (list (completing-read - "Monitor Profole: " - (monitor-profiles)))) - - (let ((cmd (mapconcat (lambda (x) (format "xrandr %s" x)) - (plist-get monitors (intern (format "%s" mon))) - " && "))) - (message "Setting monitor profile: %s" cmd) - (async-shell-command cmd "*xrandr*"))) - - (comment - ;; how to run it via elisp - (monitor :hdmi-only)) + ;; (require 'fg42/x) + ;; (setq fg42/monitors + ;; '(:hdmi-only + ;; ("--output HDMI-1 --primary" + ;; "--output eDP-1 --off") + ;; :hdmi-main + ;; ("--output HDMI-1 --primary" + ;; "--output eDP-1 --mode 1920x1080 --left-of HDMI-1") + ;; :edp-only + ;; ("--output eDP-1 --mode 1920x1080" + ;; "--output HDMI-1 --off"))) + ;; (comment + ;; ;; how to run it via elisp or just `M-x monitor' + ;; (monitor :hdmi-only)) (use-flags @@ -155,45 +79,12 @@ fg42/region-expansion-cube))) -;; Both are part of the editor cube but we want to override -;; their behavior - -(fg42/org-cube) -(fg42/cursor-cube :type 'bar :color "#bd93f9") -(fg42/font-cube :font-name "Fira code" :font-size global-font-size) -(fg42/editor-cube) - -;;(fg42/imenu-cube) -(fg42/elisp-cube) -(fg42/region-expansion-cube) -(fg42/graphviz-cube) -(fg42/company-cube) -(fg42/lsp-cube) -(fg42/c++-cube) -(fg42/python-cube) -(fg42/yaml-cube) -(fg42/flycheck-cube) - -(fg42/golang-cube) -(fg42/clojure-cube) -(fg42/projectile-cube) - -(fg42/vterm-cube) -(fg42/git-cube) -(fg42/alert-cube) -(fg42/bookmark-cube) -(fg42/terraform-cube) -(fg42/java-cube) -(fg42/yasnippet-cube) - -;; Themes should be the last cube and anything that wants to manipulate a face -;; has to use either `fg42/before-initializing-theme-hook' or -;; `fg42/after-initializing-theme-hook' hooks. -(fg42/dracula-theme-cube) -(set-face-attribute 'region nil :background "#888") +(fg42/editor + :fg42/cursor-cube '(:type 'bar :color "#bd93f9") + :fg42/font-cube '(:font-name "Fira code" :font-size global-font-size)) (when (file-exists-p "~/.fg42.user.el") (load "~/.fg42.user.el")) -(provide 'fg42.user) -;;; fg42.user.el ends here +(provide '.fg42) +;;; .fg42.el ends here diff --git a/core/cubes/autocompletion.el b/core/cubes/autocompletion.el index a98b535..0b8ab46 100644 --- a/core/cubes/autocompletion.el +++ b/core/cubes/autocompletion.el @@ -27,7 +27,8 @@ (defcube fg42/flycheck-cube "This cube adds the `flycheck' support to fg42." (:title "Flycheck cube" - :flag flycheck) + :flag flycheck + :flag-default t) (fpkg/use flycheck :defer () :init @@ -44,7 +45,8 @@ (defcube fg42/lsp-cube "LSP cube" (:title "LSP cube" - :flag lsp) + :flag lsp + :flag-default t) (fpkg/use lsp-mode :commands lsp @@ -65,7 +67,8 @@ (defcube fg42/company-cube "Auto complete using company mode" (:title "Company cube" - :flag company) + :flag company + :flag-default t) (fpkg/use company :bind (:map company-active-map diff --git a/core/cubes/editor.el b/core/cubes/editor.el index 2ff655f..1bc8325 100644 --- a/core/cubes/editor.el +++ b/core/cubes/editor.el @@ -27,6 +27,7 @@ (require 'fg42/utils) (require 'fg42/modeline) (require 'cubes/modeline) +(require 'fg42/themes) (defflag font-icons "Enable the support for font icones in FG42." t) @@ -184,7 +185,6 @@ data. The typical example of this would be Lisp or Scheme source code." (: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) @@ -202,8 +202,6 @@ data. The typical example of this would be Lisp or Scheme source code." "Replace this with a theme cube" (:title "Dracula theme" :no-flag t) - (require 'fg42/themes) - (fpkg/use dracula-theme :init @@ -216,7 +214,8 @@ data. The typical example of this would be Lisp or Scheme source code." '(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)))) + (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. @@ -326,19 +325,7 @@ https://emacsthemes.com/themes/badwolf-theme.html" #'fg42/default-modeline))) ;;(fg42/statusbar-cube) (fg42/modeline-cube) - (fg42/setup-modeline-format mline)) - - (fg42/emojify-cube) - (fg42/discover-cube) - (fg42/folding-cube) - (fg42/font-cube) - (fg42/pinentry-cube) - (fg42/exec-path-cube) - (fg42/buffer-navigation-cube) - (fg42/window-navigation-cube) - (fg42/selectrum-cube) - (fg42/cursor-cube) - (fg42/hl-cube)) + (fg42/setup-modeline-format mline))) (provide 'cubes/editor) diff --git a/core/cubes/fg42.el b/core/cubes/fg42.el new file mode 100644 index 0000000..0bee733 --- /dev/null +++ b/core/cubes/fg42.el @@ -0,0 +1,76 @@ +;;; FG42Cube --- The meta cube for FG42 -*- lexical-binding: t; -*- +;; +;; Copyright (c) 2010-2023 Sameer Rahmani & Contributors +;; +;; Author: Sameer Rahmani +;; URL: https://ziglab.com/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 'fg42/cube) +(require 'fg42/utils) + +(require 'cubes/editor) +(require 'cubes/org) +(require 'cubes/elisp) +(require 'cubes/region-expansion) +(require 'cubes/wm) +(require 'cubes/modeline) +(require 'cubes/autocompletion) +(require 'cubes/golang) +(require 'cubes/project) +(require 'cubes/irc) +(require 'cubes/terminal) +(require 'cubes/java) +(require 'cubes/python) +(require 'cubes/cpp) +(require 'cubes/snippets) +(require 'cubes/rust) +(require 'cubes/mastodon) +(require 'cubes/git) +(require 'cubes/bookmark) +(require 'cubes/terraform) +(require 'cubes/graph) +(require 'cubes/clojure) +(require 'cubes/scheme) +(require 'cubes/meson) +(require 'cubes/godot3d) +(require 'cubes/meissa) +(require 'cubes/proof) +(require 'cubes/agda) +(require 'cubes/notifications) + + +(defcube fg42/editor + "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) + + (mapc + (lambda (cube) + (let ((params (plist-get fg42/editor-params + (intern (concat ":" (symbol-name cube)))))) + (eval `(funcall #',cube ,@params)))) + fg42/available-cubes)) + + + +(provide 'cubes/fg42) +;;; fg42.el ends here diff --git a/core/cubes/golang.el b/core/cubes/golang.el index 16fed57..76d41c2 100644 --- a/core/cubes/golang.el +++ b/core/cubes/golang.el @@ -29,7 +29,8 @@ (defcube fg42/golang-cube "Golang support cube for fg42." - (:title "Golang cube" :flag golang) + (:title "Golang cube" :flag golang + :flag-default t) (fpkg/use go-mode :defer t diff --git a/core/cubes/groovy.el b/core/cubes/groovy.el index c4ce1a3..6d97da0 100644 --- a/core/cubes/groovy.el +++ b/core/cubes/groovy.el @@ -25,6 +25,7 @@ (require 'fg42/cube) (require 'fg42/utils) + (defcube fg42/groovy-cube "Groovy support for FG42." (:title "Groovy cube" diff --git a/core/cubes/mastodon.el b/core/cubes/mastodon.el index d4580dc..aaf7e80 100644 --- a/core/cubes/mastodon.el +++ b/core/cubes/mastodon.el @@ -41,7 +41,7 @@ For more info on check out [[https://codeberg.org/martianh/mastodon.el]]" (:title "Mastodone Cube" :flag mastodon - :flag-default t) + :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/modeline.el b/core/cubes/modeline.el index ff36299..ad20e10 100644 --- a/core/cubes/modeline.el +++ b/core/cubes/modeline.el @@ -79,7 +79,15 @@ (setq fg42/modeline-setter #'fg42/mini-modeline-setter)) :defer nil :config - (add-hook 'fg42-after-init-hook #'mini-modeline-mode))) + (add-hook 'fg42-after-init-hook #'mini-modeline-mode) + (add-hook 'fg42/after-initializing-theme-hook + (lambda () + (custom-set-faces + '(mini-modeline-mode-line + ((((background light)) + :background "#aa0000" :height 0.1 :box nil) + (t + :background "#bd93f9" :height 0.1 :box nil)))))))) (defcube fg42/statusbar-cube @@ -89,7 +97,7 @@ valuable information." (:title "Status bar cube" :flag status-bar :group modeline - :flag-default t) + :flag-default nil) (fg42/all-the-icons-cube) diff --git a/core/cubes/python.el b/core/cubes/python.el index e2120da..e37cf9c 100644 --- a/core/cubes/python.el +++ b/core/cubes/python.el @@ -69,7 +69,8 @@ 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 python-pyls + :flag-default nil) (when-flag lsp (with-eval-after-load "lsp" @@ -85,7 +86,8 @@ 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 python-pyright + :flag-default t) (fpkg/use lsp-pyright :ensure t @@ -112,7 +114,8 @@ interactive `pyvenv-workon' function before `lsp'" (defcube fg42/python-cube "Python support cube." (:title "Python cube" - :flag python) + :flag python + :flag-default t) (fpkg/use pyvenv :defer t diff --git a/core/fg42/cube.el b/core/fg42/cube.el index e4dddcd..bfb97e7 100644 --- a/core/fg42/cube.el +++ b/core/fg42/cube.el @@ -30,7 +30,7 @@ (defvar fg42/after-cubes-setup-hook nil "A hook that will be run after all the active cubes got setup. -This hook is dedicated for the codes that needs to do stuff based on other cubes +This hook is dedicated for the codes that need to do stuff based on other cubes presence. With this hook we eliminate the need for cube ordering. It will be called in the `fg42-config' and the proper way to use @@ -88,7 +88,7 @@ it is to use `fg42/after-cubes' macro.") ;; * Hooks ;; This hook can be used by others to run code just before running that - ;; code body + ;; cube's body (defvar ,pre-init-hook nil ,(format "The hook that runs befor the '%s' cube initialization." cube-name)) @@ -98,7 +98,6 @@ it is to use `fg42/after-cubes' macro.") (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 diff --git a/core/fg42/proof.el b/core/fg42/proof.el deleted file mode 100644 index e69de29..0000000 diff --git a/core/fg42/themes.el b/core/fg42/themes.el index 6f64f51..65ee7db 100644 --- a/core/fg42/themes.el +++ b/core/fg42/themes.el @@ -37,9 +37,9 @@ (defmacro fg42/setup-theme (&rest body) "Run the BODY inside the FG42 theme setup context." `(progn + ;; TODO: This is a bad practice. Find a better solution (run-hooks 'fg42/before-initializing-theme-hook) - ,@body - (run-hooks 'fg42/after-initializing-theme-hook))) + ,@body)) (provide 'fg42/themes) diff --git a/core/fpkg/core.el b/core/fpkg/core.el index ec23f0a..fedc7e8 100644 --- a/core/fpkg/core.el +++ b/core/fpkg/core.el @@ -60,5 +60,6 @@ (load bootstrap-file nil 'nomessage) (fpkg/install-and-load-use-package))) + (provide 'fpkg/core) ;;; core.el ends here diff --git a/fg42-config.el b/fg42-config.el index 57bbaa6..b7f7c38 100644 --- a/fg42-config.el +++ b/fg42-config.el @@ -38,7 +38,7 @@ (getenv "HOME"))) -;; Load the custom ization file. In FG42 it is different than +;; Load the customization file. In FG42 it is different than ;; the default `user-init-file' (if (file-exists-p custom-file) (load custom-file)) @@ -50,6 +50,7 @@ (run-hooks 'fg42/after-cubes-setup-hook) (run-hooks 'fg42-after-init-hook) +(run-hooks 'fg42/after-initializing-theme-hook) (provide 'fg42-config) ;;; fg42-config.el ends here