From bbc0fad735fb2f0c412f3265cdfd0e913d1f8593 Mon Sep 17 00:00:00 2001 From: Sameer Rahmani Date: Fri, 10 May 2024 18:22:31 +0100 Subject: [PATCH] Remove the v3 related code --- lisp/fg42.el | 126 --------- lisp/fg42/autocomplete.el | 60 ---- lisp/fg42/core.el | 45 --- lisp/fg42/deps.el | 129 --------- lisp/fg42/direnv.el | 33 --- lisp/fg42/editor.el | 301 -------------------- lisp/fg42/eglot.el | 39 --- lisp/fg42/elisp.el | 38 --- lisp/fg42/flags.el | 133 --------- lisp/fg42/help.el | 46 --- lisp/fg42/init.el | 84 ------ lisp/fg42/langs/cpp.el | 91 ------ lisp/fg42/langs/elisp.el | 42 --- lisp/fg42/langs/langs.el | 45 --- lisp/fg42/langs/nix.el | 49 ---- lisp/fg42/langs/python.el | 60 ---- lisp/fg42/langs/verilog.el | 66 ----- lisp/fg42/modeline.el | 84 ------ lisp/fg42/modeline/units.el | 90 ------ lisp/fg42/modeline/views.el | 102 ------- lisp/fg42/project.el | 114 -------- lisp/fg42/shell.el | 115 -------- lisp/fg42/status.el | 73 ----- lisp/fg42/statusbar.el | 501 --------------------------------- lisp/fg42/themes.el | 98 ------- lisp/fg42/utils.el | 161 ----------- lisp/fg42/wm.el | 173 ------------ lisp/fg42/x.el | 66 ----- lisp/fpkg.el | 69 ----- lisp/fpkg/core.el | 66 ----- lisp/ob-graphviz-dot.el | 85 ------ nix/modules/wm/lisp/fg42/wm.el | 2 +- 32 files changed, 1 insertion(+), 3185 deletions(-) delete mode 100644 lisp/fg42.el delete mode 100644 lisp/fg42/autocomplete.el delete mode 100644 lisp/fg42/core.el delete mode 100644 lisp/fg42/deps.el delete mode 100644 lisp/fg42/direnv.el delete mode 100644 lisp/fg42/editor.el delete mode 100644 lisp/fg42/eglot.el delete mode 100644 lisp/fg42/elisp.el delete mode 100644 lisp/fg42/flags.el delete mode 100644 lisp/fg42/help.el delete mode 100644 lisp/fg42/init.el delete mode 100644 lisp/fg42/langs/cpp.el delete mode 100644 lisp/fg42/langs/elisp.el delete mode 100644 lisp/fg42/langs/langs.el delete mode 100644 lisp/fg42/langs/nix.el delete mode 100644 lisp/fg42/langs/python.el delete mode 100644 lisp/fg42/langs/verilog.el delete mode 100644 lisp/fg42/modeline.el delete mode 100644 lisp/fg42/modeline/units.el delete mode 100644 lisp/fg42/modeline/views.el delete mode 100644 lisp/fg42/project.el delete mode 100644 lisp/fg42/shell.el delete mode 100644 lisp/fg42/status.el delete mode 100644 lisp/fg42/statusbar.el delete mode 100644 lisp/fg42/themes.el delete mode 100644 lisp/fg42/utils.el delete mode 100644 lisp/fg42/wm.el delete mode 100644 lisp/fg42/x.el delete mode 100644 lisp/fpkg.el delete mode 100644 lisp/fpkg/core.el delete mode 100644 lisp/ob-graphviz-dot.el diff --git a/lisp/fg42.el b/lisp/fg42.el deleted file mode 100644 index 2edec42..0000000 --- a/lisp/fg42.el +++ /dev/null @@ -1,126 +0,0 @@ -;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*- -;; -;; Copyright (c) 2010-2024 Sameer Rahmani -;; -;; Author: Sameer Rahmani -;; URL: https://devheroes.codes/FG42/FG42 -;; Version: 4.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/core) -(require 'fg42/utils) - - -(defvar fg42/-gc-cons-threshold 16777216 - "Value of GC threshold of FG42.") - -(defvar fg42/initialized nil - "A variable that indicates whether FG42 is passed initialization.") - -(defun defer-garbage-collection () - "Disable garbage collection." - (setq gc-cons-threshold fg42/-gc-cons-threshold)) - - -(defun restore-garbage-collection () - "Restore garbage collection to it's default value." - (run-at-time - 1 nil (lambda () (setq gc-cons-threshold most-positive-fixnum)))) - - -(defun fg42/initialize () - "Initialize FG42 after the Emacs window is rendered by loading the user init file." - ;; (fg42/-startup-optimization) - (require 'fpkg/core) - (fpkg/initialize) - - (when (file-exists-p user-init-file) - (require 'fg42/cube) - (require 'fg42/flags) - (require 'fg42/cubes/fg42) - - (load user-init-file)) - - (add-hook 'emacs-startup-hook - (lambda () - (run-hooks 'fg42/-cubes-body-hook) - (run-hooks 'fg42/after-cubes-setup-hook) - (run-hooks 'fg42/after-init-hook) - (run-hooks 'fg42/after-initializing-theme-hook) - (run-hooks 'fg42/ui-hook) - (setq fg42/initialized t)))) - - -(defun fg42/initialize-v4 () - "Initialize FG42 after the Emacs window is rendered by loading the user init file." - ;; (fg42/-startup-optimization) - (require 'fg42/editor) - - (when (file-exists-p user-init-file) - (load user-init-file)) - - ;; If user didn't select a theme, load the default stuff - (when (not (featurep 'fg42/themes)) - (require 'fg42/themes)) - - (fg42/setup-editor) - - (add-hook 'emacs-startup-hook - (lambda () - (run-hooks 'fg42/after-init-hook) - (run-hooks 'fg42/after-initializing-theme-hook) - (run-hooks 'fg42/ui-hook) - (setq fg42/initialized t)))) - - -(defun fg42/-startup-optimization () - "Optimized FG42 startup." - ;; by setting gc threshold to the largest number - ;; Emacs can understand we are basically disabling it :). - (setq gc-cons-threshold most-positive-fixnum - gc-cons-percentage 0.6) - ;; after initilization phase restore cons threshold to normal - (add-hook 'emacs-startup-hook - (lambda () - (setq gc-cons-threshold fg42/-gc-cons-threshold ; 16mb - gc-cons-percentage 0.1))) - - ;; disable auto initilization of package.el - (setq package-enable-at-startup nil) - ;; disable gc when we are in minibuffer using the same method we - ;; use for initilization time - (add-hook 'minibuffer-setup-hook #'defer-garbage-collection) - ;; just enable gc when exiting minibuffer - (add-hook 'minibuffer-exit-hook #'restore-garbage-collection) - ;; we dont need Emacs to check every file type and look for file - ;; handlers when we are initializing so we backup the original - ;; value and set it to nil - (setq --file-name-handler-alist file-name-handler-alist) - - (setq file-name-handler-alist nil) - ;; after initialization we can restore that file-name-handler-alist - ;; to original value. - (add-hook 'emacs-startup-hook - (lambda () - (setq file-name-handler-alist - --file-name-handler-alist))) - ;; initial mode for emacs can be fundamental mode we have nothing to lose - (setq initial-major-mode 'fundamental-mode)) - - -(provide 'fg42) -;;; fg42.el ends here diff --git a/lisp/fg42/autocomplete.el b/lisp/fg42/autocomplete.el deleted file mode 100644 index 81c33d2..0000000 --- a/lisp/fg42/autocomplete.el +++ /dev/null @@ -1,60 +0,0 @@ -;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*- -;; -;; Copyright (c) 2010-2024 Sameer Rahmani & Contributors -;; -;; Author: Sameer Rahmani -;; URL: https://devheroes.codes/FG42/FG42 -;; Version: 4.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: -(eval-when-compile - (require 'fpkg)) - - -(use! company - "Company is a modular text completion framework for GNU Emacs." - :commands global-company-mode - :bind (:map company-active-map - ("M-n" . company-select-next) - ("M-p" . company-select-previous) - ("TAB" . company-complete-common-or-cycle) - ("M-d" . company-show-doc-buffer)) - :init - ;; Use Company for completion - (setq company-show-numbers t) - (setq company-idle-delay 0) - (setq company-tooltip-limit 20) - (setq company-echo-delay 0) - (setq company-tooltip-align-annotations t) - (setq company-dabbrev-downcase nil) - - :config - (setq-default company-backends - '((company-capf :with company-yasnippet :separate) - (company-keywords company-dabbrev company-ispell :separate) - company-files)) - (bind-key [remap completion-at-point] #'company-complete company-mode-map)) - - -(use! company-box - "A company front-end with icons." - :after company - :hook (company-mode . company-box-mode)) - - -(provide 'fg42/autocomplete) -;;; autocomplete.el ends here diff --git a/lisp/fg42/core.el b/lisp/fg42/core.el deleted file mode 100644 index 6c6ab92..0000000 --- a/lisp/fg42/core.el +++ /dev/null @@ -1,45 +0,0 @@ -;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*- -;; -;; Copyright (c) 2010-2024 Sameer Rahmani -;; -;; Author: Sameer Rahmani -;; URL: https://devheroes.codes/FG42/FG42 -;; Version: 4.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: - -(defgroup fg42 nil - "Customize your FG42 instance via this group of configurations.") - -(defvar fg42/after-init-hook nil - "The hook tha runs when FG42 finished running the user configuration.") - -(defvar fg42/debug-p nil - "The hook tha runs when FG42 finished running the user configuration.") - -(defvar fg42-config-dir (or (getenv "FG42_CONFIG_DIR") "~/.fg42") - "Where to store installation specific data.") - -(defvar fg42-home (getenv "FG42_HOME") - "The pass to fg42-home.") - - -(defvar fg42-tmp (concat fg42-config-dir "/tmp")) - - -(provide 'fg42/core) -;;; core.el ends here diff --git a/lisp/fg42/deps.el b/lisp/fg42/deps.el deleted file mode 100644 index 5a7d641..0000000 --- a/lisp/fg42/deps.el +++ /dev/null @@ -1,129 +0,0 @@ -;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*- -;; -;; Copyright (C) 2010-2024 Sameer Rahmani -;; -;; Author: Sameer Rahmani -;; Keywords: lisp fg42 IDE package manager -;; Version: 1.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: -;; This file contains all the dependencies of FG42 v4 in no particular order. -;; Whether we use a package during runtime or not we will build everything -;; and decide what to load at runtime. -;; -;; We fetch these dependencies using Nix via the emacs-overlay. -;; -;;; Code: -(defmacro depends-on (&rest _) - "Just a placeholder." - nil) - -(depends-on - bm - command-log-mode - dockerfile-mode - lsp-ltex - dracula-theme - lsp-julia - flycheck-julia - julia-formatter - julia-repl - julia-mode - nix-mode - noether-mode - ednc - idris-mode - company-coq - proof-general - msgpack - gdscript-mode - meson-mode - lsp-scheme - clojure-mode - cider - aggressive-indent - graphviz-dot-mode - terraform-mode - magit - diff-hl - rustic - yasnippet - yasnippet-snippets - ninja-mode - eldoc-cmake - cmake-mode - poetry - lsp-pyright - python-black - lsp-java - flycheck-gradle - gradle-mode - groovy-mode - use-package - vterm - projectile-ripgrep - go-mode - company-box - company - lsp-ui - lsp-mode - yaml-mode - flycheck - expand-region - eros - org - org-modern - org-super-agenda - org-ql - ctrlf - badwolf-theme - ace-window - avy - paredit - rainbow-delimiters - exec-path-from-shell - discover - emojify - alert - imenu-list - pinentry - helpful - which-key - dirvish - origami - f - projectile - mini-modeline - smart-mode-line - all-the-icons - exwm - verilog-ext - verilog-mode - pkg-info - envrc - vertico - orderless - eglot - marginalia - nerd-icons - forge - svg-tag-mode - base16-theme - consult - nerd-icons-completion) - -(provide 'fg42/deps) -;;; deps.el ends here diff --git a/lisp/fg42/direnv.el b/lisp/fg42/direnv.el deleted file mode 100644 index 23dd93a..0000000 --- a/lisp/fg42/direnv.el +++ /dev/null @@ -1,33 +0,0 @@ -;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*- -;; -;; Copyright (C) 2010-2024 Sameer Rahmani -;; -;; Author: Sameer Rahmani -;; Keywords: lisp fg42 IDE package manager -;; Version: 1.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: -;; This file contains all the dependencies of FG42 v4 in no particular order. -;; Whether we use a package during runtime or not we will build everything -;; and decide what to load at runtime. -;; -;; We fetch these dependencies using Nix via the emacs-overlay. -;; -;;; Code: - - -(provide 'fg42/direnv) -;;; direnv.el ends here diff --git a/lisp/fg42/editor.el b/lisp/fg42/editor.el deleted file mode 100644 index 05015cd..0000000 --- a/lisp/fg42/editor.el +++ /dev/null @@ -1,301 +0,0 @@ -;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*- -;; -;; Copyright (c) 2010-2024 Sameer Rahmani & Contributors -;; -;; Author: Sameer Rahmani -;; URL: https://devheroes.codes/FG42/FG42 -;; Version: 4.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: -(eval-when-compile - (require 'fpkg) - ;; Language support - (require 'fg42/autocomplete) - (require 'fg42/langs/langs) - (require 'fg42/eglot) - (require 'fg42/langs/cpp) - (require 'fg42/langs/verilog) - (require 'fg42/langs/python) - (require 'fg42/langs/elisp) - (require 'fg42/langs/nix) - - (require 'fg42/git) - (require 'fg42/wm) - (require 'fg42/org) - (require 'fg42/minibuffer) - (require 'fg42/graphics) - (require 'fg42/modeline)) - -(require 'server) - - -(defvar fg42/font '("Fira Mono" 12) - "Font name and size to be used with FG42. (Default (\"Fira Mono\" 12).") - -(defvar fg42/snippet-dir nil - "Where to find user's snippets.") - - -(defun fg42/setup-font () - "Set the default font of `FG42' to FONT-NAME and FONT-SIZE." - (let ((name (car fg42/font)) - (size (cadr fg42/font))) - (add-to-list 'default-frame-alist - (cons 'font (format "%s-%d" name size))) - - (set-face-attribute 'default t :font name))) - - - -(defun fg42/setup-editor () - "Setup the overall functionality of FG42." - (use! origami - "A text folding minor mode for Emacs." - :bind - (("C-c TAB" . origami-toggle-node)) - :config - (global-origami-mode t)) - - (use! which-key - "which-key is a minor mode for Emacs that displays the key bindings following -your currently entered incomplete command (a prefix) in a popup. For example, -after enabling the minor mode if you enter ~C-x~ and wait for the default of -1 second the minibuffer will expand with all of the available key bindings -that follow ~C-x~ (or as many as space allows given your settings). -This includes prefixes like ~C-x 8~ which are shown in a different face." - :config - (which-key-setup-side-window-bottom) - (which-key-mode)) - - (use! projectile - "Projectile is a project interaction library for Emacs. Its goal is to provide -a nice set of features operating on a project level without introducing -external dependencies." - :hook (emacs-startup . projectile-mode) - :config - ;; We don't want the auto discovery on startup - (setq projectile-auto-discover nil) - (setq projectile-enable-caching t) - - :bind (:map projectile-mode-map - ("s-p" . projectile-command-map) - ("C-c p" . projectile-command-map))) - - - (use! projectile-ripgrep - "Use ripgrep with projectile" - :after projectile) - - - (use! pkg-info - "`pkg-info' integration.") - - - (use! expand-region - "Expand region increases the selected region by semantic units. -Just keep pressing the key until it selects what you want." - :bind ("C-=" . er/expand-region)) - - - (use! helpful - "Helpful is an alternative to the built-in Emacs help that provides much more -contextual information." - :bind - (("C-h f" . helpful-callable) - ("C-h v" . helpful-variable) - ("C-h k" . helpful-key) - ("C-h x" . helpful-command) - ("C-c C-d" . helpful-at-point))) - - (use! envrc - "Activate direnv whenever encounter a `.envrc' file" - :config - (envrc-global-mode)) - - (use! pinentry - "Pinentry cube with setup the =pinentry= program to be used within FG42." - :commands pinentry-start - :init - (setq epa-pinentry-mode 'loopback)) - - (use! imenu-list - "his Emacs minor-mode creates an automatically updated buffer - called `Ilist' that is populated with the current buffer's imenu entries. - The `Ilist' buffer is typically shown as a sidebar (Emacs vertically splits the window)." - :bind (("C-'" . imenu-list-smart-toggle))) - - (use! discover - "Adds support for the discover.el `https://github.com/mickeynp/discover.el'.") - - (use! exec-path-from-shell - "This package fixes the =exec-path-from-shell= issue on MacOS." - :config - (when (memq window-system '(mac ns x)) - (exec-path-from-shell-initialize))) - - (use! hl-line - "Highlights the current line." - :hook (emacs-startup . global-hl-line-mode)) - - (use! avy - "This cube controls the different aspect of buffer navigation" - :bind ("M-1" . avy-goto-word-1)) - - (use! ace-window - "This cube controls the different aspect of buffer navigation" - :bind ("C-" . ace-window)) - - (when-not-wm - - (use! flyspell - "Spell checking on the fly" - :commands (flyspell-mode flyspell-prog-mode) - :init - (setq-default ispell-program-name "aspell") - (setq-default ispell-extra-args '("--sug-mode=ultra" - "--lang=en_US" - "--camel-case"))) - - (use! savehist - "Persist history over Emacs restarts. Vertico sorts by history position." - :init - (savehist-mode)) - - (use! display-line-numbers - "The builtin replacement of linum. It's is pretty fast." - :config - (global-display-line-numbers-mode 1))) - - - (use! yasnippet - "A Snippet is a template system for Emacs. " - :config - (let* ((snippet-home - (expand-file-name - "snippets" - (file-name-directory (locate-library "yasnippet-snippets")))) - (local-snippet (expand-file-name "snippets" fg42-home)) - (user-snippets (or fg42/snippet-dir local-snippet))) - - (setq yas-snippet-dirs `(,user-snippets ,local-snippet ,snippet-home)) - (yas-global-mode 1))) - - (use! yasnippet-snippets - "Yasnippet's snippets." - :after yasnippet) - - - (use! flycheck - "Flycheck is a modern on-the-fly syntax checking extension for GNU Emacs." - :config (global-flycheck-mode)) - - ;; In the following section we're setting some default behavior of FG42. - ;; Most of these configuration are opiniated and I think most of people - ;; shared the same opinion or don't care at all. - (fg42/setup-font) - (add-hook 'fg42/after-initializing-theme-hook - (lambda () - (set-default 'cursor-type 'bar) - (set-cursor-color "#eeeeec"))) - - ;; Remove splash screen - (setq inhibit-splash-screen t) - ;; scratch should be scratch - (setq initial-scratch-message nil) - ;; Don't allow tab as indent - (setq-default indent-tabs-mode nil) - ;; Default indent width - (setq tab-width 2) - ;; Share the clipboard with X applications - (setq x-select-enable-clipboard t) - ;; Automatically removed excess backups of the file - (setq delete-old-versions t) - ;; Emacs 28 and newer: Hide commands in M-x which do not work in the current - ;; mode. Vertico commands are hidden in normal buffers. This setting is - ;; useful beyond Vertico. - (setq read-extended-command-predicate #'command-completion-default-include-p) - - ;; Support opening new minibuffers from inside existing minibuffers. - (setq enable-recursive-minibuffers t) - - (setq tooltip-use-echo-area t) - (setq x-gtk-use-system-tooltips nil) - - ;; Global configurations - (tool-bar-mode -1) - (tooltip-mode nil) - (menu-bar-mode -1) - - (when (display-graphic-p) - ;; Smoother scrolling - (pixel-scroll-precision-mode) - (scroll-bar-mode -1)) - - (defalias 'yes-or-no-p 'y-or-n-p) - - ;; Hooks --- - (add-hook - 'emacs-startup-hook - (lambda () - ;; It only applies to toolkit=no - (set-mouse-color (get-base16-color-or :base07 "#eeeeec")) - - ;; Switch from `dabbrev-expand' to `hippie-expand' - (global-set-key [remap dabbrev-expand] 'hippie-expand) - - (column-number-mode t) - (show-paren-mode t) - (electric-pair-mode 1) - (global-company-mode) - - ;; git changes in the fringe - (global-diff-hl-mode) - - ;; Modeline replacement - (noether-global-mode) - - ;; Rectangular select - (cua-selection-mode t) - - ;; Yank the region on type - (delete-selection-mode 1))) - - ;; Deletel extra trailing white spaces on save - (add-hook 'before-save-hook 'delete-trailing-whitespace) - - ;; Enable rainbow-delimiters for programming - (add-hook 'prog-mode-hook #'rainbow-delimiters-mode) - - ;; With this section we will have two emacs server running - ;; this way we can interact with the wm via emacsclient as well - (when (not (server-running-p)) - (when-wm - (setq server-name "fg42-wm")) - (server-start) - (require 'org-protocol)) - - (when-wm - ;; Activating the WM mode - (debug) - (exwm-enable) - (exwm-systemtray-enable) - (exwm-randr-enable)) - (message "[FG42]: Use `fg42-help' to get help.")) - - -(provide 'fg42/editor) -;;; editor.el ends here diff --git a/lisp/fg42/eglot.el b/lisp/fg42/eglot.el deleted file mode 100644 index b91977f..0000000 --- a/lisp/fg42/eglot.el +++ /dev/null @@ -1,39 +0,0 @@ -;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*- -;; -;; Copyright (c) 2010-2024 Sameer Rahmani & Contributors -;; -;; Author: Sameer Rahmani -;; URL: https://devheroes.codes/FG42/FG42 -;; Version: 4.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: -(eval-when-compile - (require 'fpkg)) - - -;; Language Servers and friends -(use! eglot - "Eglot is a minimalistic yet powerful LSP replacement -shipped with Emacs." - :hook - (prog-mode . eglot-ensure) - (prog-mode . (lambda () - (add-hook 'before-save-hook 'eglot-format nil t)))) - - -(provide 'fg42/eglot) -;;; eglot.el ends here diff --git a/lisp/fg42/elisp.el b/lisp/fg42/elisp.el deleted file mode 100644 index 101540a..0000000 --- a/lisp/fg42/elisp.el +++ /dev/null @@ -1,38 +0,0 @@ -;;; ElispCube --- The elisp cube for FG42 -*- lexical-binding: t; -*- -;; -;; Copyright (c) 2010-2024 Sameer Rahmani & Contributors -;; -;; Author: Sameer Rahmani -;; URL: https://devheroes.codes/FG42/FG42 -;; Version: 4.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) - - -(defun fg42/setup-elisp () - "Setup the Emacs Lisp development environment." - (use! eros - :init - (require 'eros) - (eros-mode)) - - (add-hook 'emacs-lisp-mode-hook #'rainbow-delimiters-mode)) - - -(provide 'fg42/cubes/elisp) -;;; elisp.el ends here diff --git a/lisp/fg42/flags.el b/lisp/fg42/flags.el deleted file mode 100644 index 5354c19..0000000 --- a/lisp/fg42/flags.el +++ /dev/null @@ -1,133 +0,0 @@ -;;; Flags --- Flags library of FG42 -*- lexical-binding: t; -*- -;; -;; Copyright (c) 2010-2024 Sameer Rahmani & Contributors -;; -;; Author: Sameer Rahmani -;; URL: https://devheroes.codes/FG42/FG42 -;; Version: 4.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 'cl-lib) -(require 'seq) -(require 'fg42/core) - - -(defvar fg42/available-flags nil - "A list of defined flags. - -Only use \\[defflag] to add a new flag to this list") - - -(defcustom fg42/flags nil - "A set of flags to mark the functionalities that expected from FG42. -Flags are defined using the \\[defflag] through out the source code. - -To see a list of available flags use \\[fg42/show-all-flags] and to see -the documentation of each flag simply use \\[describe-flag]." - :group 'fg42 - :package-version '(FG42 . "4.x") - :type '(symbol) - :tag "FG42 Flags") - - -(defmacro use-flags (flags) - "Set the given FLAGS to activate their functionalities in FG42." - `(progn - (setq fg42/flags ,flags) - t)) - - -(defun fg42/-merge-flags (flags-set &rest new-flags) - "Merge the given NEW-FLAGS into the FLAGS-SET and return the result." - (cl-remove-duplicates - (seq-reduce - (lambda (result flag) - (let ((flag-str (symbol-name flag))) - (if (string-prefix-p "-" flag-str) - (let ((actual-flag (intern (substring flag-str 1)))) - (if (member actual-flag result) - (remove actual-flag result) - result)) - ;; We don't want to check for duplicates here since we remove them - ;; later - (cons flag result)))) - new-flags - flags-set))) - - -(defmacro fg42/merge-flags (flags-set &rest new-flags) - "Merge the given NEW-FLAGS into the FLAGS-SET and return the result. - -If any flag name in NEW-FLAGS list starts with `-' (a dash) it implies that -that functionality has to be disabled and removed from FLAGS-SET. For example, -`-lsp' implies that we DO NOT want to have `lsp' flag enabled and it should not -exist in the return value. - -For example, `(fg42/merge-flags (list f1 f2 f3) f4 -f2)' will return `(f1 f3 f4)'" - `(fg42/-merge-flags ,flags-set ,@(mapcar (lambda (x) `',x) new-flags))) - - -(defmacro fg42/merge-with-default-flags (&rest new-flags) - "Merge the given list of NEW-FLAGS with default flags of FG42 and return the new set." - `(fg42/merge-flags fg42/flags ,@new-flags)) - - -(defmacro defflag (flag-name docstring &optional default-value) - "Define a new flag FLAG-NAME with the given DOCSTRING. -If the DEFAULT-VALUE is a non nil value, then the flag will be -added to the active flags list." - (declare (doc-string 2) (indent defun)) - (let ((var-name (intern (format "fg42/-flag-%s" (symbol-name flag-name)))) - (set-default (when default-value - `((add-to-list 'fg42/flags ',flag-name))))) - - `(if (boundp ',var-name) - (warn (format "Flag name `%s' already defined" ,(format "%s" flag-name))) - (progn - (defvar ,var-name t) - (add-to-list 'fg42/available-flags ',flag-name) - ,@set-default)))) - - -(defmacro when-flag (flag &rest body) - "Evaluate the BODY only if the given FLAG is active." - (declare (indent defun)) - ;; The `cube-local-flags' variable here is going to be - ;; defined in cubes to hold the local flags for each cube - (if (not (and (boundp 'cube-local-flags) - (member flag cube-local-flags))) - `(progn ,@body) - `(when (member ',flag fg42/flags) - ,@body))) - - -(defmacro if-flag (flag then else) - "Evaluate the THEN expr only if the given FLAG is active otherwise ELSE." - (declare (indent defun)) - ;; The `cube-local-flags' variable here is going to be - ;; defined in cubes to hold the local flags for each cube - (if (and (boundp 'cube-local-flags) - (member flag cube-local-flags)) - then - `(if (member ',flag fg42/flags) - ,then - ,else))) - - -(provide 'fg42/flags) -;;; flags.el ends here diff --git a/lisp/fg42/help.el b/lisp/fg42/help.el deleted file mode 100644 index 5fe30de..0000000 --- a/lisp/fg42/help.el +++ /dev/null @@ -1,46 +0,0 @@ -;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*- -;; -;; Copyright (c) 2010-2024 Sameer Rahmani & Contributors -;; -;; Author: Sameer Rahmani -;; URL: https://devheroes.codes/FG42/FG42 -;; Version: 4.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: - -;; emacs --batch --eval=(require 'ox-texinfo) --eval=(find-file "README.org\") --eval=(org-texinfo-export-to-info) -(require ox-texinfo) - -(org-texinfo-export-to-info) - -(defun build-manual () - "Build FG42's manual." - (interactive) - (with-temp-buffer - (find-file (file-name-concat (expand-file-name fg42-home) "docs/fg42.org")) - (org-texinfo-export-to-info))) - - -(defun fg42-manual () - "Show FG42's manual." - (interactive) - ;; TODO: move this to the init script - (add-to-list 'Info-default-directory-list (file-name-concat (expand-file-name fg42-home) "docs/")) - (info "(fg42)")) - -(provide 'fg42/help) -;;; help.el ends here diff --git a/lisp/fg42/init.el b/lisp/fg42/init.el deleted file mode 100644 index 0a83325..0000000 --- a/lisp/fg42/init.el +++ /dev/null @@ -1,84 +0,0 @@ -;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*- -;; -;; Copyright (c) 2010-2024 Sameer Rahmani -;; -;; Author: Sameer Rahmani -;; URL: https://devheroes.codes/FG42/FG42 -;; Version: 4.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: -;; This is the very first file that Emacs will load to setup FG42 -;;; Code: -(when (string= (getenv "FG42_DEBUG") "1") - (setq debug-on-error t)) - - -(eval-when-compile - (defvar package-archives) - (defvar use-package-ensure-function)) - - -(defgroup fg42 nil - "Customize your FG42 instance via this group of configurations.") - -(defvar fg42/disabled-features nil - "List of features to disable.") - -(defvar fg42/after-init-hook nil - "The hook tha runs when FG42 finished running the user configuration.") - -(defvar fg42/debug-p nil - "The hook tha runs when FG42 finished running the user configuration.") - -(defvar fg42-home (or (getenv "FG42_HOME") "~/.fg42") - "The pass to fg42-home.") - -(defvar fg42-tmp (make-temp-file "fg42-" t)) - - - -(add-to-list 'load-path (concat (getenv "FG42_HOME") "/lisp")) - -;; (when fg42-use-nix -;; (require 'site-start)) - -;; Prevent package.el to install anything at startup -(setq package-enable-at-startup nil) -(setq package-archives nil) - -(setq use-package-ensure-function 'ignore) -(setq tab-width 2) - -(let ((emacsd (or (getenv "FG42_EMACSD") (format "%s/emacs.d" (getenv "FG42_HOME"))))) - (setq custom-file (format "%s/.fg42.custom.el" emacsd)) - (setq user-emacs-directory emacsd) - (setq user-init-file - (or (getenv "FG42_CONFIG_FILE") - (format "%s/.fg42.el" - (getenv "HOME"))))) - - -;; Load the customization file. In FG42 it is different than -;; the default `user-init-file' -(if (file-exists-p custom-file) - (load custom-file)) - - -(require 'fg42) -(fg42/initialize-v4) - -(provide 'fg42/init) -;;; init.el ends here diff --git a/lisp/fg42/langs/cpp.el b/lisp/fg42/langs/cpp.el deleted file mode 100644 index aca31c0..0000000 --- a/lisp/fg42/langs/cpp.el +++ /dev/null @@ -1,91 +0,0 @@ -;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*- -;; -;; Copyright (c) 2010-2024 Sameer Rahmani & Contributors -;; -;; Author: Sameer Rahmani -;; URL: https://devheroes.codes/FG42/FG42 -;; Version: 4.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: -(eval-when-compile - (require 'fpkg)) - -(defvar fg42/clangd-args - (list - (format "-j=%s" (- (num-processors) 2)) - "--clang-tidy" - "--header-insertion=iwyu" - "--pch-storage=memory" - "--background-index" - "--cross-file-rename" - "--completion-style=detailed") - "Arguments to pass to clangd.") - -(use! cmake-ts-mode - "Enable cmake-ts-mode instead of the non-TS version.") - -(use! eldoc-cmake - "ElDoc and cmake integration" - :hook (cmake-ts-mode . eldoc-cmake-enable)) - - -(use! ninja-mode - "This cube enables Ninja integration with FG42. For more info checkout: -https://github.com/ninja-build/ninja/blob/master/misc/ninja-mode.el") - - -(defun fg42/c_cpp_ls (_) - "Return the proper lang server fo C/C++. -By default it will return `clangd' or `ccls' depends on what you have -installed. If you set `CPP_LS' env variable, then the value of that -var will be used instead. You can use `add-advice' to change the -return value of this function as well." - (let ((ls (getenv "CPP_LS"))) - (if (null ls) - (eglot-alternatives `(("clangd" ,@fg42/clangd-args) ("ccls"))) - (split-string ls " ")))) - - -(defun fg42/c-ts-mode-setup () - "A hook handler to setup cpp related configurations." - (message "[FG42][C/C++]: Make sure to setup clangd to fit your needs. For more info: https://clangd.llvm.org/config") - (setq-local company-backends - '((company-capf :with company-yasnippet) :separate - (company-keywords company-dabbrev company-ispell) :separate - company-files)) - ;; We set eglot's autoload command to `eglot-ensure' - (eglot-ensure) - (add-to-list 'eglot-server-programs - `(c++-ts-mode . ,#'fg42/c_cpp_ls))) - - -(use! c-ts-mode - "C++ setup. We're using treesitter version of c++ mode." - :init - ;; Remap the standard C/C++ modes - (add-to-list 'major-mode-remap-alist '(c-mode . c-ts-mode)) - (add-to-list 'major-mode-remap-alist '(c++-mode . c++-ts-mode)) - (add-to-list 'major-mode-remap-alist '(c-or-c++-mode . c-or-c++-ts-mode)) - - :hook - (c++-ts-mode . company-mode) - (c++-ts-mode . fg42/c-ts-mode-setup) - (c++-ts-mode . flyspell-prog-mode)) - - -(provide 'fg42/langs/cpp) -;;; cpp.el ends here diff --git a/lisp/fg42/langs/elisp.el b/lisp/fg42/langs/elisp.el deleted file mode 100644 index a56d1ec..0000000 --- a/lisp/fg42/langs/elisp.el +++ /dev/null @@ -1,42 +0,0 @@ -;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*- -;; -;; Copyright (c) 2010-2024 Sameer Rahmani & Contributors -;; -;; Author: Sameer Rahmani -;; URL: https://devheroes.codes/FG42/FG42 -;; Version: 4.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: -(eval-when-compile - (require 'fpkg)) - - -(use! eros - "Evaluation Result OverlayS for Emacs Lisp." - :commands eros-mode) - -(use! elisp-mode - "Elisp mode." - :hook - ((emacs-lisp-mode . rainbow-delimiters-mode) - (emacs-lisp-mode . paredit-mode) - (emacs-lisp-mode . company-mode) - (emacs-lisp-mode . eros-mode))) - - -(provide 'fg42/langs/elisp) -;;; elisp.el ends here diff --git a/lisp/fg42/langs/langs.el b/lisp/fg42/langs/langs.el deleted file mode 100644 index 38894b8..0000000 --- a/lisp/fg42/langs/langs.el +++ /dev/null @@ -1,45 +0,0 @@ -;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*- -;; -;; Copyright (c) 2010-2024 Sameer Rahmani & Contributors -;; -;; Author: Sameer Rahmani -;; URL: https://devheroes.codes/FG42/FG42 -;; Version: 4.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: -(eval-when-compile - (require 'fpkg)) - - -(use! rainbow-delimiters - "rainbow-delimiters is a =rainbow parentheses= like mode which highlights delimiters -such as parentheses, brackets or braces according to their depth. Each successive level -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." - ;; It doesn't work due to a problem/conflict in rainbow-delimiters - ;; But we use it any way they might fix it - :commands rainbow-delimiters-mode - :hook (prog-mode . rainbow-delimiters-mode)) - -(use! paredit - "`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." - :commands paredit-mode) - - -(provide 'fg42/langs/langs) -;;; langs.el ends here diff --git a/lisp/fg42/langs/nix.el b/lisp/fg42/langs/nix.el deleted file mode 100644 index b9ed6b8..0000000 --- a/lisp/fg42/langs/nix.el +++ /dev/null @@ -1,49 +0,0 @@ -;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*- -;; -;; Copyright (c) 2010-2024 Sameer Rahmani & Contributors -;; -;; Author: Sameer Rahmani -;; URL: https://devheroes.codes/FG42/FG42 -;; Version: 4.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: -(eval-when-compile - (require 'fpkg)) - - - -(use! nix-mode - "Nix language support for Emacs." - :mode "\\.nix\\'" - - :hook - (nix-mode . eglot-ensure) - (nix-mode . company-mode) - (nix-mode . flyspell-prog-mode) - - :init - :config - (with-eval-after-load 'eglot - ;; Force nil to use nixpkgs-fmt for formatting - (let ((nil-lsp '(nix-mode . ("nil" - :initializationOptions - (:formatting (:command ["nixpkgs-fmt"])))))) - (add-to-list 'eglot-server-programs nil-lsp)))) - - -(provide 'fg42/langs/nix) -;;; nix.el ends here diff --git a/lisp/fg42/langs/python.el b/lisp/fg42/langs/python.el deleted file mode 100644 index 89a5340..0000000 --- a/lisp/fg42/langs/python.el +++ /dev/null @@ -1,60 +0,0 @@ -;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*- -;; -;; Copyright (c) 2010-2024 Sameer Rahmani & Contributors -;; -;; Author: Sameer Rahmani -;; URL: https://devheroes.codes/FG42/FG42 -;; Version: 4.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: -(eval-when-compile - (require 'fpkg)) - - -(use! python-black - "This cube reformats python code using black formatter tool." - :commands (python-black-on-save-mode - python-black-buffer - python-black-region - python-black-statement) - :hook (python-mode . python-black-on-save-mode)) - - -(use! poetry - "Poetry support for FG42. To use it, just use `M-x poetry'." - :config - (setq poetry-tracking-strategy 'switch-buffer) - :hook (python-mode . poetry-tracking-mode)) - - -(use! python-ts-mode - "Python setup. We're using treesitter version of python mode." - :init - ;; Remap the standard python mode - (add-to-list 'major-mode-remap-alist '(python-mode . python-ts-mode)) - - :config - (setq python-indent-guess-indent-offset-verbose nil) - - :hook - (python-ts-mode . eglot-ensure) - (python-ts-mode . company-mode) - (python-ts-mode . flyspell-prog-mode)) - - -(provide 'fg42/langs/python) -;;; python.el ends here diff --git a/lisp/fg42/langs/verilog.el b/lisp/fg42/langs/verilog.el deleted file mode 100644 index 7ac08ef..0000000 --- a/lisp/fg42/langs/verilog.el +++ /dev/null @@ -1,66 +0,0 @@ -;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*- -;; -;; Copyright (c) 2010-2024 Sameer Rahmani & Contributors -;; -;; Author: Sameer Rahmani -;; URL: https://devheroes.codes/FG42/FG42 -;; Version: 4.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: -(eval-when-compile - (require 'fpkg)) - - -(use! verilog-mode - "Add support for verilog and system verilog to FG42. More info at -https://www.veripool.org/verilog-mode/") - -(use! verilog-ext - "This package provides useful extensions on top of `verilog-mode' and `verilog-ts-mode'." - :hook (verilog-mode . verilog-ext-mode) - :init - (setq verilog-ext-eglot-default-server 've-svls) - (setq verilog-ext-feature-list - '(font-lock - xref - capf - hierarchy - eglot - lsp - flycheck - beautify - navigation - template - formatter - compilation - imenu - which-func - hideshow - typedefs - time-stamp - block-end-comments - ports)) - :config - (setq verilog-ext-eglot-default-server 've-svls) - ;; I care more about ace-window than verilog-hs-toggle. - (define-key verilog-ext-mode-map (kbd "C-") #'ace-window) - (verilog-ext-eglot-set-server 've-svls) - (verilog-ext-mode-setup)) - - -(provide 'fg42/langs/verilog) -;;; verilog.el ends here diff --git a/lisp/fg42/modeline.el b/lisp/fg42/modeline.el deleted file mode 100644 index 08ca2be..0000000 --- a/lisp/fg42/modeline.el +++ /dev/null @@ -1,84 +0,0 @@ -;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*- -;; -;; Copyright (c) 2010-2024 Sameer Rahmani -;; -;; Author: Sameer Rahmani -;; URL: https://devheroes.codes/FG42/FG42 -;; Version: 4.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: -(eval-when-compile - (require 'fpkg)) - -(require 'fg42/utils) - -(defvar fg42/modeline-views nil - "A list of Noether views to use for modeline.") - - -(defvar fg42/modeline-active-face nil - "Override the active modeline face via this var.") - -(defvar fg42/modeline-inactive-face nil - "Override the inactive modeline face via this var.") - -(defface fg42/-disabled-modeline-active-border - '((t - :background "#bd93f9" :height 0.1 :box nil)) - "A new face for modeline in active state." - :group 'fg42) - - -(defface fg42/-disabled-modeline-dective-border - '((t - :background "#44475a" :height 0.1 :box nil)) - "A new face for modeline in active state." - :group 'fg42) - - -(use! noether - "Smart mode line is a pretty simple yet fantastic alternative -to Emacs modeline." - :if (display-graphic-p) - ;;:after projectile - :commands noether-global-mode - :config - (require 'noether-views) - (require 'fg42/modeline/views) - - (let ((active-border (get-base16-color-or :base0A "#bd93f9")) - (inactive-border (get-base16-color-or :base03 "#44475a"))) - (set-face-attribute 'fg42/-disabled-modeline-active-border nil :background active-border) - (set-face-attribute 'fg42/-disabled-modeline-dective-border nil :background inactive-border)) - - ;; Disable the default modeline - (setq-default mode-line-format "") - (let ((face-remaps (default-value 'face-remapping-alist))) - (setf (alist-get 'mode-line face-remaps) - (if fg42/modeline-active-face fg42/modeline-active-face 'fg42/-disabled-modeline-active-border) - (alist-get 'mode-line-inactive face-remaps) - (if fg42/modeline-inactive-face fg42/modeline-inactive-face 'fg42/-disabled-modeline-dective-border) - (default-value 'face-remapping-alist) face-remaps)) - - ;; Setup modelines - (when-not-wm - (setq-default noether-views (list fg42/modeline))) - (when-wm - (setq-default noether-views nil))) - -(provide 'fg42/modeline) -;;; modeline.el ends here diff --git a/lisp/fg42/modeline/units.el b/lisp/fg42/modeline/units.el deleted file mode 100644 index 8932c61..0000000 --- a/lisp/fg42/modeline/units.el +++ /dev/null @@ -1,90 +0,0 @@ -;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*- -;; -;; Copyright (c) 2010-2024 Sameer Rahmani -;; -;; Author: Sameer Rahmani -;; URL: https://devheroes.codes/FG42/FG42 -;; Version: 4.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: -(eval-when-compile - (require 'fpkg)) - -(require 'noether) -(require 'noether-units) -(require 'project) -(require 'nerd-icons) - - -(defvar fg42/-mode-icon) - -(defun fg42/-update-mode-icon () - "Set the current buffer name to the watched var." - (setq fg42/-mode-icon major-mode)) - - -(defun fg42/-format-mode-icon (_ v _ _) - "Format the icon V." - (format " %s " (nerd-icons-icon-for-mode v))) - - -(noether-defunit fg42/mode-icon - "Draws an icon for the current major mode." - :label "" - :len 3 - :init (lambda () - (add-hook 'post-command-hook #'fg42/-update-mode-icon)) - - :deinit (lambda () - (remove-hook 'post-command-hook #'fg42/-update-mode-icon)) - - :var 'fg42/-mode-icon - :fn #'fg42/-format-mode-icon) - -;; ============================================================================ -;; Exwm input mode -;; ============================================================================ -(defvar fg42/-exwm-input-mode nil) - -(defun fg42/-set-exwm-input-mode () - "Set the EXWM input mode for the current buffer." - (setq fg42/-exwm-input-mode (format "%s" exwm--input-mode))) - - -(defun fg42/-format-exwm-input-mode (_ v _ _) - "Just return the input mode name V." - (if (=string v "line") - (propertize "L" 'font-lock-face `(:foreground ,(get-base16-color-or :base07 "eeeeec"))) - (propertize "C" 'font-lock-face `(:foreground ,(get-base16-color-or :base0A "eeeeec"))))) - - -(noether-defunit fg42/exwm-input-mode-unit - "Show the input mode of EXWM for the current buffer." - :label "I:" - :len 4 - :init (lambda () - (when (featurep 'exwm) - (add-hook 'noether-on-buffer-change-hook #'fg42/-set-exwm-input-mode))) - :deinit (lambda () - (when (featurep 'exwm) - (remove-hook 'noether-on-buffer-change-hook #'fg42/-set-exwm-input-mode))) - :var 'fg42/-exwm-input-mode - :fn #'fg42/-format-exwm-input-mode) - - -(provide 'fg42/modeline/units) -;;; units.el ends here diff --git a/lisp/fg42/modeline/views.el b/lisp/fg42/modeline/views.el deleted file mode 100644 index 686e5ad..0000000 --- a/lisp/fg42/modeline/views.el +++ /dev/null @@ -1,102 +0,0 @@ -;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*- -;; -;; Copyright (c) 2010-2024 Sameer Rahmani -;; -;; Author: Sameer Rahmani -;; URL: https://devheroes.codes/FG42/FG42 -;; Version: 4.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: -(eval-when-compile - (require 'fpkg)) - -(require 'fg42/modeline/units) - - -(defun fg42/--bottom-right (info) - "Keep the modeline at bottom right by using the data from INFO." - (cons -1 -1)) - -(defun fg42/--bottom-right-padded (info) - "Keep the modeline at bottom right by using the data from INFO." - (cons -70 -1)) - - -(defun fg42/adjust-modeline (view) - "Adjust the VIEW after parent frame resize." - (noether-show view)) - - -(noether-defview fg42/modeline - "A simple and minimalist mode-line like status bar" - :managed? t - :binding (kbd "C-c 0") - :buffer "*modeline*" - :visible? t - :timeout 0 - :on-parent-resize #'fg42/adjust-modeline - :frame - (list - :right-fringe 5 - :poshandler #'fg42/--bottom-right - :border-width 0 - :font (format "%s %s" (car fg42/font) (- (cadr fg42/font) 1)) - :border-color "#bd93f9") - - :units - (list - (buffer-name-unit - :label (format "%s " (nerd-icons-codicon "nf-cod-layers")) - :len 20) - (project-unit - :label (format "%s " (nerd-icons-octicon "nf-oct-project")) - :len 20) - (git-branch-unit - :label (format "%s " (nerd-icons-devicon "nf-dev-git_branch")) - :len 20) - (fg42/mode-icon) - (line-unit :label (format "%s " (nerd-icons-codicon "nf-cod-location"))) - (time-unit :label (format " %s " (nerd-icons-mdicon "nf-md-clock_time_three"))))) - - -(noether-defview fg42/minimal-exwm - "A super simple bar containing the line number and column number that -Appears on the center of the current window." - :managed? t - :buffer "*exwm-status*" - :binding (kbd "C-c 1") - :separator " | " - - :timeout 10 - :frame - (list - :poshandler #'fg42/--bottom-right-padded - :border-width 0 - :border-color "#bd93f9") - - :units - (list - (fg42/exwm-input-mode-unit :label (format "%s " (nerd-icons-faicon "nf-fa-linux"))) - (buffer-name-unit - :label (format "%s " (nerd-icons-codicon "nf-cod-layers")) - :len 30) - - (time-unit :label (format "%s " (nerd-icons-mdicon "nf-md-clock_time_three"))))) - - -(provide 'fg42/modeline/views) -;;; views.el ends here diff --git a/lisp/fg42/project.el b/lisp/fg42/project.el deleted file mode 100644 index 14db81d..0000000 --- a/lisp/fg42/project.el +++ /dev/null @@ -1,114 +0,0 @@ -;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*- -;; -;; Copyright (c) 2010-2024 Sameer Rahmani -;; -;; Author: Sameer Rahmani -;; URL: https://devheroes.codes/FG42/FG42 -;; Version: 4.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: -;; `System' is just a state monad which holds the state of the editor. -;; Each system has to have a `start' function to start the setup process. -;; -;;; Code: -(eval-when-compile - (require 'fpkg)) -(fpkg/require 'f) - - -(defgroup fg42/project nil - "The customization group for the fg42-project-global-mode." - :group 'convenience) - - -(defvar fg42/visited-projects nil - "A plist of all the visited projects. -It's mapping of project name to the project datastructure") - -(defmacro defproject (&rest props) - "Define a project with given PROPS to be used with FG42's project system." - (let* ((p (projectile-project-name)) - (pr (projectile-project-root)) - (f-name (intern (format "project/%s" p)))) - (when (not p) - (error "Can't detect the projectile project. Is it a git repo?")) - - `(progn - (defun ,f-name () - ,(format "Project '%s' configuration. Location: '%s'" p pr) - (list ,@props)) - - (when (not (plist-member fg42/visited-projects ,(symbol-name f-name))) - (plist-put fg42/visited-projects ,p #',f-name))))) - - -(defun fg42/-project-get-or-load-file () - "Return the project plist either from the cache or by loading the `.fg42.el' file." - (let* ((p (projectile-project-name)) - (f-name (intern (format "project/%s" p)))) - - (if (functionp f-name) - (funcall f-name) - (when (projectile-project-root) - (let ((file (f-join (projectile-project-root) ".fg42.el"))) - (if (file-exists-p file) - (progn - (load file) - (if (functionp f-name) - (funcall f-name) - (progn - (warn "'%s' does not define a project." (f-join (projectile-project-root) ".fg42.el")) - nil))) - nil)))))) - - -(defun fg42/project-run-slot (n) - "Run the slot number N of the current project." - (let ((p (fg42/-project-get-or-load-file))) - (funcall - (or (plist-get p (intern (format ":slot-%s" n))) - (lambda () (message "No task.")))))) - - -(defmacro fg42/-project-define-slots (n) - "Define N slots." - `(progn - ,@(mapcar - (lambda (x) - `(progn - (defun ,(intern (format "fg42/project-slot-%s" x)) () - (format "Run the slot number %s of the current project." ,x) - (interactive) - (fg42/project-run-slot ,x)) - (define-key fg42-project-global-mode-map (kbd ,(format "C-c C-%s" x)) - (function ,(intern (format "fg42/project-slot-%s" x)))))) - (number-sequence 0 n)))) - - -;;;###autoload -(define-minor-mode fg42-project-global-mode - "A minor mode to activate FG42 project mode." - :global t - :lighter "Pj42" - :group 'fg42/project - :keymap (make-sparse-keymap) - (if fg42-project-global-mode - (fg42/-project-define-slots 9) - (message "Fg42 project is disabled"))) - - -(provide 'fg42/project) -;;; project.el ends here diff --git a/lisp/fg42/shell.el b/lisp/fg42/shell.el deleted file mode 100644 index 397e9f8..0000000 --- a/lisp/fg42/shell.el +++ /dev/null @@ -1,115 +0,0 @@ -;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*- -;; -;; Copyright (c) 2010-2024 Sameer Rahmani -;; -;; Author: Sameer Rahmani -;; URL: https://devheroes.codes/FG42/FG42 -;; Version: 4.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: -;; `System' is just a state monad which holds the state of the editor. -;; Each system has to have a `start' function to start the setup process. -;; -;;; Code: -(require 'seq) -(require 'fg42/utils) - -(fpkg/require 's) - -(defmacro ->commands (&rest body) - "Return a list of shell commands in the BODY. - -Each element has to be list like `(cd \"..\")' the command is static but -the arguments get evaluated." - `(quote - ,(mapcar - (lambda (x) - (when (not (listp x)) - (error "Expect a list. Got %s" x)) - (let ((command (car x)) - (args (cdr x))) - (cond - ((string= command "and") (s-join " && " (eval `(->commands ,@args)))) - ((string= command "or") (s-join " || " (eval `(->commands ,@args)))) - (t (format "%s %s" command (mapconcat #'eval args " ")))))) - body))) - - -(defun shell<- (commands &rest opts) - "Run the give list of COMMANDS via ssh on HOST with the given OPTS. - -OPTS: -- `:shell' The shell to run the commands with. (default /bin/bash) -- `:buffer' The buffer name to use. (default '*ssh[SHELL]*') -- `:erase?' Whether or not erase the buffer. (default t)" - (let* ((sh (or (plist-get opts :shell) "/bin/bash")) - (buffer (or (plist-get opts :buffer) (format "*shell[%s]*" sh))) - (erase? (or (plist-get opts :erase-buffer?) t)) - (cmds (format "'%s'" (mapconcat #'identity commands ";"))) - (output-buffer (get-buffer-create buffer))) - - (when erase? - (with-current-buffer output-buffer - (setq buffer-read-only nil) - (erase-buffer))) - (let ((p (start-process-shell-command - "shell<-" - (buffer-name output-buffer) - (format "%s -c %s" - sh - cmds)))) - (set-process-sentinel p - (lambda (_ event) - (when (string= event "finished\n") - (message "Commands finished.") - ;;(kill-process process) - )))))) - - -(defun ssh<- (host commands &rest opts) - "Run the give list of COMMANDS via ssh on HOST with the given OPTS. - -OPTS: -- `:shell' The shell to run the commands with. (default /bin/bash) -- `:buffer' The buffer name to use. (default '*ssh[HOST]*') -- `:erase?' Whether or not erase the buffer. (default t)" - (let* ((sh (or (plist-get opts :shell) "/bin/bash")) - (buffer (or (plist-get opts :buffer) (format "*ssh[%s]*" host))) - (erase? (or (plist-get opts :erase-buffer?) t)) - (cmds (format "'%s'" (mapconcat #'identity commands ";"))) - (output-buffer (get-buffer-create buffer))) - - (when erase? - (with-current-buffer output-buffer - (setq buffer-read-only nil) - (erase-buffer))) - - (let ((p (start-process-shell-command - (format "ssh-to-%s" host) - (buffer-name output-buffer) - (format "ssh -t %s %s -c %s" - host - sh - cmds)))) - (set-process-sentinel p - (lambda (_ event) - (when (string= event "finished\n") - (message "Commands finished. Closing SSH connection.") - ;;(kill-process process) - )))))) - -(provide 'fg42/shell) -;;; shell.el ends here diff --git a/lisp/fg42/status.el b/lisp/fg42/status.el deleted file mode 100644 index 3e3c901..0000000 --- a/lisp/fg42/status.el +++ /dev/null @@ -1,73 +0,0 @@ -;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*- -;; -;; Copyright (c) 2010-2024 Sameer Rahmani -;; -;; Author: Sameer Rahmani -;; URL: https://devheroes.codes/FG42/FG42 -;; Version: 4.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: - -;; Some of the functions in this module are borrowed from `mini-modeline' -;; at https://github.com/kiennq/emacs-mini-modeline (GPL). I modified to -;; fit my needs. - -;;; Require -(require 'fpkg) -(fpkg/require 'all-the-icons) -(fpkg/require 'posframe) - -(defvar fg42/status-buffer "*status-buffer*" - "The name of the status buffer to use.") - - -(defun fg42/status-show () - (interactive) - (with-current-buffer fg42/status-buffer - (erase-buffer) - (insert (propertize (all-the-icons-octicon "package") - 'face `(:family ,(all-the-icons-octicon-family) :height 1) - ;; 'display '(raise -0.1) - ) ) - (insert "| A | B | C")) - - (posframe-show - fg42/status-buffer - :min-height 1 - :min-width 10 - :position (cons (- (frame-outer-width) 10) (- (frame-outer-height) 10)) - - ;;:poshandler #'posframe-poshandler-frame-bottom-right-corner - ;;:border-width 1 - :border-color "#aa00bb" - :accept-focus nil - :timeout 5 - :refresh 1)) - - -(posframe-delete-all) -(define-minor-mode fg42/global-statue-mode - "A minor mode that keep tracks of different status blocks. -It reports them back in a status bar like frame." - :global t - :lighter " ST42" - :keymap (let ((map (make-sparse-keymap))))) - -(fg42/global-statue-mode) - -(provide 'status.el) -;;; status.el ends here diff --git a/lisp/fg42/statusbar.el b/lisp/fg42/statusbar.el deleted file mode 100644 index 10d6d1d..0000000 --- a/lisp/fg42/statusbar.el +++ /dev/null @@ -1,501 +0,0 @@ -;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*- -;; -;; Copyright (c) 2010-2024 Sameer Rahmani -;; -;; Author: Sameer Rahmani -;; URL: https://devheroes.codes/FG42/FG42 -;; Version: 4.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: - -;; Some of the functions in this module are borrowed from `mini-modeline' -;; at https://github.com/kiennq/emacs-mini-modeline (GPL). I modified to -;; fit my needs. - -;;; Require -(require 'minibuffer) -(require 'frame) -(require 'timer) -(require 'face-remap) - -;; ============================================================================ -;; customizations -;; ============================================================================ - -(defgroup fg42/statusbar nil - "Status bar group." - :group 'fg42/statusbar) - - -(defcustom fg42/statusbar-components - '("random" (buffer-name)) - "Default active components." - :type 'list - :group 'fg42/statusbar) - - -(defcustom fg42/statusbar-truncate-p t - "Truncates fg42/statusbar or not." - :type 'boolean - :group 'fg42/statusbar) - - -(defcustom fg42/statusbar-echo-duration 5 - "Duration to keep display echo." - :type 'integer - :group 'fg42/statusbar) - -(defcustom fg42/statusbar-refresh-idle-delay 0.1 - "Update idle delay of bar in seconds." - :type 'double - :group 'fg42/statusbar) - - -(defcustom fg42/statusbar-frame nil - "Frame to display fg42/statusbar on. -Nil means current selected frame." - :type 'sexp - :group 'fg42/statusbar) - - -(defcustom fg42/statusbar-display-gui-line t - "Display thin line at the bottom of the window." - :type 'boolean - :group 'fg42/statusbar) - - -(defvar fg42/statusbar-height 4) - -(defcustom fg42/statusbar-face-attr `(:background ,(face-attribute 'mode-line :background)) - "Plist of face attribute/value pair for fg42/statusbar." - :type '(plist) - :group 'fg42/statusbar) - -;; ============================================================================ -;; Faces -;; ============================================================================ - -(defface fg42/statusbar-mode-line - '((((background light)) - :background "#55ced1" :height 0.1 :box nil) - (t - :background "#3f3f3f" :height 0.2 :box nil)) - - "Modeline face for active window." - :group 'fg42/statusbar) - -(defface fg42/statusbar-components - '((t :inherit t :height 0.7)) - - "Modeline face for active window." - :group 'fg42/statusbar) - - -(defface fg42/statusbar-mode-line-inactive - '((((background light)) - :background "#dddddd" :height 0.1 :box nil) - (t - :background "#333333" :height 0.1 :box nil)) - "Modeline face for inactive window." - :group 'fg42/statusbar) - - -;; ============================================================================ -;; Vars -;; ============================================================================ -(defvar fg42/statusbar-info-padding-right 0) - -(defvar fg42/statusbar--msg nil) - -(defvar fg42/statusbar--msg-message nil - "Store the string from `message'.") - -(defvar fg42/statusbar--last-update (current-time)) - -(defvar fg42/statusbar--last-change-size (current-time)) - -(defvar fg42/statusbar--last-echoed nil) - -(defvar fg42/statusbar-timer nil) - -(defvar fg42/statusbar-active-p nil) - -(defvar fg42/statusbar--cache nil) - -(defvar fg42/statusbar--orig-resize-mini-windows resize-mini-windows) - -(defvar fg42/statusbar--minibuffer nil) - -(defvar fg42/statusbar--echo-keystrokes echo-keystrokes) - -(defvar fg42/statusbar-command-state 'begin - "The state of current executed command begin -> [exec exec-read] -> end.") - -(defvar fg42/statusbar-enable-hook nil) -(defvar fg42/statusbar-disable-hook nil) - -(defvar-local fg42/statusbar--orig-mode-line mode-line-format) - -(defvar-local fg42/statusbar--face-cookie nil) - -(defvar fg42/statusbar--orig-mode-line-remap - (or (alist-get 'mode-line face-remapping-alist) 'mode-line)) - -(defvar fg42/statusbar--orig-mode-line-inactive-remap - (or (alist-get 'mode-line-inactive face-remapping-alist) 'mode-line-inactive)) - -;; ============================================================================ -;; Definitions -;; ============================================================================ -(defmacro fg42/statusbar-wrap (func &rest body) - "Add an advice around FUNC with name fg42/statusbar--%s. -BODY will be supplied with orig-func and args." - (let ((name (intern (format "fg42/statusbar--%s" func)))) - `(advice-add #',func :around - (lambda (orig-func &rest args) - ,@body) - '((name . ,name))))) - - -(defmacro defbar-unit (name interval default &rest body) - "Create a status bar unit with a dedicated timer. - -It will create a unit with the given NAME and DEFAULT value and a timer -that runs the given BODY at the given INTERVAL." - (declare (indent defun)) - (let ((timer-name (intern (format "$%s-timer" name)))) - `(progn - (defvar ,name ,default) - (defvar ,timer-name) - (let ((fn (lambda () ,@body))) - (add-hook 'fg42/statusbar-enable-hook - (lambda () - (setq ,timer-name - (run-with-timer 0 ,interval - (lambda () - (setq ,name (funcall fn)))))))) - - (add-hook 'fg42/statusbar-disable-hook - (lambda () - (when (timerp ,timer-name) - (cancel-timer ,timer-name))))))) - - -(defsubst fg42/statusbar-pre-cmd () - "Pre command hook of fg42/statusbar." - (setq fg42/statusbar-command-state 'begin)) - - -(defsubst fg42/statusbar-post-cmd () - "Post command hook of fg42/statusbar." - (setq fg42/statusbar-command-state 'end - echo-keystrokes fg42/statusbar--echo-keystrokes)) - - -(defsubst fg42/statusbar-enter-minibuffer () - "`minibuffer-setup-hook' of fg42/statusbar." - (fg42/statusbar--set-buffer-face) - (setq resize-mini-windows 'grow-only)) - - -(defsubst fg42/statusbar-exit-minibuffer () - "`minibuffer-exit-hook' of fg42/statusbar." - (with-current-buffer fg42/statusbar--minibuffer - (fg42/statusbar--set-buffer-face)) - (setq resize-mini-windows nil)) - - -(defun fg42/statusbar--set-buffer-face () - "Set buffer default face for current buffer." - (setq fg42/statusbar--face-cookie - (face-remap-add-relative 'default fg42/statusbar-face-attr))) - - -(defun fg42/statusbar-enable () - "Enable the statusbar." - - ;; Hide modeline for terminal, or use empty modeline for GUI. - (setq-default fg42/statusbar--orig-mode-line mode-line-format) - (setq-default mode-line-format (when (and fg42/statusbar-display-gui-line - (display-graphic-p)) - '(" "))) - ;; Do the same thing with opening buffers. - (mapc - (lambda (buf) - (with-current-buffer buf - (when (local-variable-p 'mode-line-format) - (setq fg42/statusbar--orig-mode-line mode-line-format) - (setq mode-line-format (when (and fg42/statusbar-display-gui-line - (display-graphic-p)) - '(" ")))) - - (when (or (minibufferp buf) - (string-prefix-p " *Echo Area" (buffer-name))) - (fg42/statusbar--set-buffer-face)) - ;; Make the modeline in GUI a thin bar. - (when (and fg42/statusbar-display-gui-line - (local-variable-p 'face-remapping-alist) - (display-graphic-p)) - (setf (alist-get 'mode-line face-remapping-alist) - 'fg42/statusbar-mode-line - (alist-get 'mode-line-inactive face-remapping-alist) - 'fg42/statusbar-mode-line-inactive)))) - (buffer-list)) - - ;; Make the modeline in GUI a thin bar. - (when (and fg42/statusbar-display-gui-line - (display-graphic-p)) - (let ((face-remaps (default-value 'face-remapping-alist))) - (setf (alist-get 'mode-line face-remaps) - 'fg42/statusbar-mode-line - (alist-get 'mode-line-inactive face-remaps) - 'fg42/statusbar-mode-line-inactive - (default-value 'face-remapping-alist) face-remaps))) - - (setq fg42/statusbar--orig-resize-mini-windows resize-mini-windows) - (setq resize-mini-windows nil) - (redisplay) - - (advice-add #'message :around #'fg42/statusbar-message-advice) - - ;; Add update timer. - (setq fg42/statusbar-timer - (run-with-timer 0 fg42/statusbar-refresh-idle-delay #'fg42/statusbar-display)) - - (add-hook 'minibuffer-setup-hook #'fg42/statusbar-enter-minibuffer) - (add-hook 'minibuffer-exit-hook #'fg42/statusbar-exit-minibuffer) - (add-hook 'pre-command-hook #'fg42/statusbar-pre-cmd) - (add-hook 'post-command-hook #'fg42/statusbar-post-cmd) - - ;;(add-hook 'focus-in-hook 'fg42/statusbar-show-info) - (add-function :after after-focus-change-function #'fg42/statusbar-display) - - ;; read-key-sequence - (fg42/statusbar-wrap - read-key-sequence - (progn - (setq fg42/statusbar-command-state 'exec-read) - (apply orig-func args))) - - (fg42/statusbar-wrap - read-key-sequence-vector - (progn - (setq fg42/statusbar-command-state 'exec-read) - (apply orig-func args))) - - (run-hooks 'fg42/statusbar-enable-hook) - (setq fg42/statusbar-active-p t)) - - -(defun fg42/statusbar-disable () - "Disable the status bar." - - (setq-default mode-line-format (default-value 'fg42/statusbar--orig-mode-line)) - (when (display-graphic-p) - (let ((face-remaps (default-value 'face-remapping-alist))) - (setf (alist-get 'mode-line face-remaps) - fg42/statusbar--orig-mode-line-remap - (alist-get 'mode-line-inactive face-remaps) - fg42/statusbar--orig-mode-line-inactive-remap - (default-value 'face-remapping-alist) face-remaps))) - - (mapc - (lambda (buf) - (with-current-buffer buf - (when (local-variable-p 'mode-line-format) - (setq mode-line-format fg42/statusbar--orig-mode-line)) - (when fg42/statusbar--face-cookie - (face-remap-remove-relative fg42/statusbar--face-cookie)) - (when (and (local-variable-p 'face-remapping-alist) - (display-graphic-p)) - (setf (alist-get 'mode-line face-remapping-alist) - fg42/statusbar--orig-mode-line-remap - (alist-get 'mode-line-inactive face-remapping-alist) - fg42/statusbar--orig-mode-line-inactive-remap)))) - - (buffer-list)) - - (setq resize-mini-windows fg42/statusbar--orig-resize-mini-windows) - (redisplay) - - (advice-remove #'message #'fg42/statusbar-message-advice) - (advice-remove #'read-key-sequence 'fg42/statusbar--read-key-sequence) - (advice-remove #'read-key-sequence-vector 'fg42/statusbar--read-key-sequence-vector) - - (remove-hook 'minibuffer-setup-hook #'fg42/statusbar-enter-minibuffer) - (remove-hook 'minibuffer-exit-hook #'fg42/statusbar-exit-minibuffer) - (remove-hook 'pre-command-hook #'fg42/statusbar-pre-cmd) - (remove-hook 'post-command-hook #'fg42/statusbar-post-cmd) - - ;; Cancel timer. - (when (timerp fg42/statusbar-timer) - (cancel-timer fg42/statusbar-timer)) - - (remove-function after-focus-change-function #'fg42/statusbar-display) - - ;; Update mode-line. - (force-mode-line-update) - (redraw-display) - - (with-current-buffer " *Minibuf-0*" - (erase-buffer)) - - (run-hooks 'fg42/statusbar-disable-hook) - (setq fg42/statusbar-active-p nil)) - - -(defun fg42/statusbar-build-active-info () - "Collect the information from active components." - (mapconcat - (lambda (form) - (let ((result (eval form))) - (when (not (stringp result)) - (error "The result of %s is not string" result)) - (when (> (length result) 0) - result))) - fg42/statusbar-components - "")) - - -(defun fg42/statusbar-get-frame-width () - "Only calculating a main Frame width, to avoid wrong width when new frame, such -as `snails'." - (if (display-graphic-p) - (with-selected-frame (car (last (frame-list))) - (frame-width)) - (frame-width))) - - -(defun fg42/statusbar-get-echo-format-string (info message-string) - (let* ((blank-length (- (fg42/statusbar-get-frame-width) - (string-width info) - (string-width (or message-string "")) - fg42/statusbar-info-padding-right))) - (cond - ;; Fill message's end with whitespace to keep the info at right of minibuffer. - ((> blank-length 0) - (progn - (let* ((inhibit-message t)) - (concat message-string - (make-string (max 0 (- (fg42/statusbar-get-frame-width) - (string-width (or message-string "")) - (string-width info) - fg42/statusbar-info-padding-right)) ?\ ) - info)))) - (t message-string)))) - - -(defsubst fg42/statusbar--overduep (since duration) - "Check if time already pass DURATION from SINCE." - (>= (float-time (time-since since)) duration)) - - -(defun fg42/statusbar--log (&rest args) - "Log message into message buffer with ARGS as same parameters in `message'." - (save-excursion - (with-current-buffer "*Messages*" - (let ((inhibit-read-only t)) - (goto-char (point-max)) - (insert (apply #'format args)))))) - - -(defun fg42/statusbar-display (&optional arg) - "Update fg42/statusbar. -When ARG is: -- `force', force update the minibuffer. -- `clear', clear the minibuffer. This implies `force'." - (save-match-data - (let ((bar-info (fg42/statusbar-build-active-info))) - (condition-case err - - (cl-letf (((symbol-function 'completion-all-completions) #'ignore)) - (unless (or (active-minibuffer-window) - (input-pending-p)) - (setq fg42/statusbar--minibuffer - (window-buffer (minibuffer-window fg42/statusbar-frame))) - (with-current-buffer fg42/statusbar--minibuffer - (let ((truncate-lines fg42/statusbar-truncate-p) - (inhibit-read-only t) - (inhibit-redisplay t) - (buffer-undo-list t) - modeline-content) - (when (or (memq arg '(force clear)) - (fg42/statusbar--overduep fg42/statusbar--last-update - fg42/statusbar-refresh-idle-delay)) - (when-let ((msg (or fg42/statusbar--msg-message (current-message)))) - ;; Clear echo area and start new timer for echo message - (message nil) - (setq fg42/statusbar--last-echoed (current-time)) - ;; we proritize the message from `message' - ;; or the message when we're not in middle of a command running. - (when (or fg42/statusbar--msg-message - (eq fg42/statusbar-command-state 'begin)) - (setq fg42/statusbar-command-state 'exec) - ;; Don't echo keystrokes when in middle of command - (setq echo-keystrokes 0)) - (setq fg42/statusbar--msg msg)) - ;; Reset echo message when timeout and not in middle of command - (when (and fg42/statusbar--msg - (not (memq fg42/statusbar-command-state '(exec exec-read))) - (fg42/statusbar--overduep fg42/statusbar--last-echoed - fg42/statusbar-echo-duration)) - (setq fg42/statusbar--msg nil)) - ;; Showing fg42/statusbar - (if (eq arg 'clear) - (setq modeline-content nil) - (setq modeline-content - (fg42/statusbar-get-echo-format-string bar-info fg42/statusbar--msg)) - (setq fg42/statusbar--last-update (current-time))) - - ;; write to minibuffer - (unless (equal modeline-content - fg42/statusbar--cache)) - (setq fg42/statusbar--cache modeline-content) - (erase-buffer) - (when fg42/statusbar--cache - (let ( - ;;let fg42/statusbar take control of mini-buffer size - (resize-mini-windows t)) - (insert fg42/statusbar--cache)))))))) - ((error debug) - (fg42/statusbar--log "fg42/statusbar: %s\n" err)))))) - - -(defun fg42/statusbar-message-advice (f &rest args) - "Wrap `message' make status bar information visible always -even other plugins call `message' to flush minibufer." - (if inhibit-message - (apply f args) - (let* ((inhibit-message t) - (fg42/statusbar--msg-message (apply f args))) - (fg42/statusbar-display 'force) - fg42/statusbar--msg-message))) - - -;;;###autoload -(define-minor-mode fg42/statusbar-mode - "Super simple status bar for FG42." - :require 'fg42/statusbar-mode - :lighter "SB" - :global t - (if fg42/statusbar-mode - (fg42/statusbar-enable) - (fg42/statusbar-disable))) - - -(provide 'fg42/statusbar) -;;; statusbar.el ends here diff --git a/lisp/fg42/themes.el b/lisp/fg42/themes.el deleted file mode 100644 index 36e0ff9..0000000 --- a/lisp/fg42/themes.el +++ /dev/null @@ -1,98 +0,0 @@ -;;; Themes --- Theme library of FG42 -*- lexical-binding: t; -*- -;; -;; Copyright (c) 2010-2024 Sameer Rahmani & Contributors -;; -;; Author: Sameer Rahmani -;; URL: https://devheroes.codes/FG42/FG42 -;; Version: 4.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: -;; Cubes are the building blocks of any `FG42' editor. Each `cube' is a -;; unit which defines different abilities in a deterministic and idempotent -;; way. Cubes are composable and a composition of cubes creates an editor. -;; -;;; Code: -(eval-when-compile - (require 'fpkg)) -(require 'fg42/utils) - -(defvar fg42/ui-hook () - "A hook that cubes can use via :ui-hook property. -It executes way before the rest of the cubes.") - -(defvar fg42/before-initializing-theme-hook () - "The hook to plug any configuration to before initialize event of themes.") - -(defvar fg42/after-initializing-theme-hook () - "The hook to plug any configuration to after initialize event of themes.") - - -(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)) - - -(defmacro use-theme! (name &rest body) - "Create a function to setup a them with the given NAME and BODY to customize it." - (declare (indent defun)) - (let ((fn-name (intern (format "fg42/setup-%s" (symbol-name name))))) - `(defun ,fn-name () - (use! ,name - "Setting up the ,name package." - :init - (fg42/setup-theme - (require ',name) - ,@body))))) - - -;; (use-theme! dracula-theme -;; :init -;; (fg42/setup-theme -;; (require 'dracula-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")))) -;; ;; This fixes lsp-ui-sideline issue -;; '(lsp-ui-sideline-current-symbol ((t (:line-width -1 :foreground "#bd93f9")))) -;; '(font-lock-comment-delimiter-face ((t (:foreground "#5B6268"))))) -;; (enable-theme 'dracula) -;; (set-face-attribute 'region nil :background "#888"))) - - -(use-theme! badwolf-theme - :init - (fg42/setup-theme - (load-theme 'badwolf t) - (custom-theme-set-faces - 'badwolf) - (enable-theme 'badwolf))) - - -(use! base16-theme - "Load base16 based themes in FG42." - :config - (load-theme 'base16-eighties t)) - - -(provide 'fg42/themes) -;;; themes.el ends here diff --git a/lisp/fg42/utils.el b/lisp/fg42/utils.el deleted file mode 100644 index 1f8d8e8..0000000 --- a/lisp/fg42/utils.el +++ /dev/null @@ -1,161 +0,0 @@ -;;; Utils --- Utils library of FG42 -*- lexical-binding: t; -*- -;; -;; Copyright (c) 2010-2024 Sameer Rahmani -;; -;; Author: Sameer Rahmani -;; URL: https://devheroes.codes/FG42/FG42 -;; Version: 4.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: -;; `System' is just a state monad which holds the state of the editor. -;; Each system has to have a `start' function to start the setup process. -;; -;;; Code: -(require 'cl-lib) - -(autoload 'seq-partition "seq") -(autoload 'cl-reduce "cl-seq") - - -(defun buffer-mode (buffer-or-string) - "Return the major mode associated with a the given BUFFER-OR-STRING." - (with-current-buffer buffer-or-string - major-mode)) - - -(defun ->buffer (buffer-name data &optional fn) - "Insert the given DATA into the given buffer provided by BUFFER-NAME. - -It will create a the buffer if it doesn't exist. It will call the given FN -at the end in context of the buffer. This function accepts only one argument -with is the buffer." - (let ((buf (get-buffer-create buffer-name))) - (with-current-buffer buf - (insert data) - (when fn - (funcall fn buf))))) - - -(defun ->str (&rest args) - "Convert the given ARGS into string." - (funcall #'pp-to-string args)) - - -(defmacro inspect-expression (&rest body) - "Pretty prints the result of the given BODY." - `(pp-display-expression ,@body (get-buffer-create fg42/inspect-buffer))) - - -(defun inspect-data-append (data) - "Append the given DATA to the inspection buffer with padding." - ;; TODO: Move 'fg42/inspect-buffer' to the somewhere propriate - ;; possiblly the system. - (->buffer - "fg42/inspect-buffer" - (format - "\n;; START ======================================================\n%s%s" - (pp-to-string data) - ";; END.\n"))) - - -(defun apply-face (face-symbol text) - "Apply the given FACE-SYMBOL to the given TEXT." - (put-text-property 0 (length text) 'face face-symbol text)) - - -(defmacro comment (&rest _body) - "A macro similar to Clojure's comment macro that ignore the BODY." - (declare (indent 0)) - `nil) - - -(defmacro debug-message (&rest params) - "Print out the given PARAMS only if debug mode is on." - (if debug-on-error - `(message ,@params) - nil)) - - -(defmacro deprecated (msg &rest form) - "Mark the given FORM as deprecated with the given MSG." - (declare (indent 0)) - `(progn - (warn (format "[DEPRECATED]: %s" ,msg)) - ,@form)) - - -(defun path-join (&rest paths) - "Join the given PATHS." - (apply #'concat - (append - (mapcar #'file-name-as-directory (butlast paths)) - (last paths)))) - - -(defmacro -> (x &optional form &rest more) - "Thread the expr through the forms FORM and rest of form in MORE. -Insert X as the second item in the first form, making a list of -it if it is not a list already. If there are more forms, insert -the first form as the second item in second form, etc." - (declare (debug (form &rest [&or symbolp (sexp &rest form)]))) - (cond - ((null form) x) - ((null more) (if (listp form) - `(,(car form) ,x ,@(cdr form)) - (list form x))) - (:else `(-> (-> ,x ,form) ,@more)))) - - -(defmacro ->> (x &optional form &rest more) - "Thread the expr through the forms FORM and the rest at MORE. -Insert X as the last item in the first form, making a list of -it if it is not a list already. If there are more forms, insert -the first form as the -last item in second form, etc." - (declare (debug ->)) - (cond - ((null form) x) - ((null more) (if (listp form) - `(,@form ,x) - (list form x))) - (:else `(->> (->> ,x ,form) ,@more)))) - - -(defmacro when-wm (&rest body) - "Run the BODY only if in wm mode." - (if (string= (getenv "FG42_WM") "true") - `(progn ,@body) - nil)) - -(defmacro when-not-wm (&rest body) - "Run the BODY only if not in the wm mode." - (if (not (string= (getenv "FG42_WM") "true")) - `(progn ,@body) - nil)) - - -(defun get-base16-color-or (color-name default) - "Return the color for COLOR-NAME if a base16 theme is loade otherwise DEFAULT." - (let* ((theme (car custom-enabled-themes)) - (theme-sym (intern (format "%s-theme-colors" theme)))) - - (if (boundp theme-sym) - (or (eval `(plist-get ,theme-sym ,color-name)) default) - default))) - - -(provide 'fg42/utils) -;;; utils.el ends here diff --git a/lisp/fg42/wm.el b/lisp/fg42/wm.el deleted file mode 100644 index c8ad3ae..0000000 --- a/lisp/fg42/wm.el +++ /dev/null @@ -1,173 +0,0 @@ -;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*- -;; -;; Copyright (c) 2010-2024 Sameer Rahmani & Contributors -;; -;; Author: Sameer Rahmani -;; URL: https://devheroes.codes/FG42/FG42 -;; Version: 4.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: -(eval-when-compile - (require 'fpkg)) - - -(defvar workspace-configuration - (list 0 "HDMI-1" - 1 "HDMI-1" - 2 "HDMI-1" - 3 "HDMI-1" - 4 "HDMI-1" - 5 "HDMI-1" - 6 "HDMI-1" - 7 "HDMI-1" - 8 "HDMI-1" - 9 "HDMI-1") - "Workspace configuration for EXWM. (default 10 screens on HDMI-1).") - -;; TODO: Document this -;; (add-hook 'exwm-randr-screen-change-hook -;; (lambda () -;; (start-process-shell-command -;; "xrandr" nil "xrandr --output HDMI-1 --above eDP-1 --mode 1920x1080"))) - - -(when-wm - (use! exwm-randr - "EXWM plugin to interact with xrandr." - :commands exwm-randr-enable - :config - (setq exwm-randr-workspace-output-plist workspace-configuration)) - - - (use! exwm-systemtray - "Enables systemtray on EXWM" - :after exwm) - - - ;; (use! mini-frame - ;; "Place minibuffer at the top of the current frame on `read-from-minibuffer'." - ;; :hook (emacs-startup . mini-frame-mode) - ;; :custom - ;; (mini-frame-show-parameters - ;; '((top . 10) - ;; (width . 0.5) - ;; (left . 0.5) - ;; (height . 15)))) - - - (use! exwm - "Emacs X Widnow manager." - :commands exwm-enable - :config - (require 'exwm-config) - (exwm-config-ido) - - ;; Set the initial number of workspaces (they can also be created later). - (setq exwm-workspace-number 10) - ;; All buffers created in EXWM mode are named "*EXWM*". You may want to - ;; change it in `exwm-update-class-hook' and `exwm-update-title-hook', which - ;; are run when a new X window class name or title is available. Here's - ;; some advice on this topic: - ;; + Always use `exwm-workspace-rename-buffer` to avoid naming conflict. - ;; + For applications with multiple windows (e.g. GIMP), the class names of - ;; all windows are probably the same. Using window titles for them makes - ;; more sense. - ;; In the following example, we use class names for all windows except for - ;; Java applications and GIMP. - (add-hook 'exwm-update-class-hook - (lambda () - (unless (or (string-prefix-p "sun-awt-X11-" exwm-instance-name) - (string= "gimp" exwm-instance-name)) - (exwm-workspace-rename-buffer exwm-class-name)))) - - (add-hook 'exwm-update-title-hook - (lambda () - (when (or (not exwm-instance-name) - (string-prefix-p "sun-awt-X11-" exwm-instance-name) - (string= "gimp" exwm-instance-name)) - (exwm-workspace-rename-buffer exwm-title)))) - - ;; Global keybindings can be defined with `exwm-input-global-keys'. - ;; Here are a few examples: - (setq exwm-input-global-keys - `( - ;; Bind "s-r" to exit char-mode and fullscreen mode. - ([?\s-r] . exwm-reset) - ([?\s-g] . keyboard-quit) - ([8388640] . other-window) - ;; Bind "s-w" to switch workspace interactively. - ([?\s-w] . exwm-workspace-switch) - ;; Bind "s-0" to "s-9" to switch to a workspace by its index. - ,@(mapcar (lambda (i) - `(,(kbd (format "s-%d" i)) . - (lambda () - (interactive) - (exwm-workspace-switch-create ,i)))) - (number-sequence 0 9)) - ;; Bind "s-&" to launch applications ('M-&' also works if the output - ;; buffer does not bother you). - ([?\s-d] . (lambda (command) - (interactive (list (read-shell-command "$ "))) - (start-process-shell-command command nil command))) - ;; Bind "s-" to "slock", a simple X display locker. - ([s-f2] . (lambda () - (interactive) - (start-process "" nil "slock"))))) - - ;; To add a key binding only available in line-mode, simply define it in - ;; `exwm-mode-map'. The following example shortens 'C-c q' to 'C-q'. - (define-key exwm-mode-map [?\C-q] #'exwm-input-send-next-key) - - (push ?\C-c exwm-input-prefix-keys) - - ;; You can hide the minibuffer and echo area when they're not used, by - ;; uncommenting the following line. - ;;(setq exwm-workspace-minibuffer-position 'bottom) - - ;; The following example demonstrates how to use simulation keys to mimic - ;; the behavior of Emacs. The value of `exwm-input-simulation-keys` is a - ;; list of cons cells (SRC . DEST), where SRC is the key sequence you press - ;; and DEST is what EXWM actually sends to application. Note that both SRC - ;; and DEST should be key sequences (vector or string). - (setq exwm-input-simulation-keys - `( - ;; movement - (,(kbd "C-b") . left) - (,(kbd "M-b") . ,(kbd "C-")) - (,(kbd "C-f") . right) - (,(kbd "M-f") . ,(kbd "C-")) - (,(kbd "C-p") . up) - (,(kbd "C-n") . down) - (,(kbd "C-a") . home) - (,(kbd "C-e") . end) - (,(kbd "M-v") . prior) - (,(kbd "C-v") . next) - (,(kbd "C-d") . delete) - ;;(,(kbs "C-k") . [S-end delete]) - ;; navigation - (,(kbd "C-c b") . ,(kbd "M-")) - (,(kbd "C-c f") . ,(kbd "M-")) - (,(kbd "C-c w") . ,(kbd "C-w")) - (,(kbd "C-w") . ,(kbd "C-x")) - (,(kbd "M-w") . ,(kbd "C-c")) - (,(kbd "C-y") . ,(kbd "C-v")) - ;; search - (,(kbd "C-s") . ,(kbd "C-f")))))) - - -(provide 'fg42/wm) -;;; wm.el ends here diff --git a/lisp/fg42/x.el b/lisp/fg42/x.el deleted file mode 100644 index 3fbd8c9..0000000 --- a/lisp/fg42/x.el +++ /dev/null @@ -1,66 +0,0 @@ -;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*- -;; -;; Copyright (c) 2010-2024 Sameer Rahmani -;; -;; Author: Sameer Rahmani -;; URL: https://devheroes.codes/FG42/FG42 -;; Version: 4.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 'seq) - -(defvar fg42/monitors nil - "A plist containing monitor resolution profiles. -for example: -'(: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\"))") - - -(defun fg42/get-x11-selection-text () - "Return the X11 selection paste text." - (interactive) - (gui-get-selection 'PRIMARY)) - - -(defun monitor-profiles () - "Parse the `fg42/monitors' profiles." - (mapcar - #'car - (seq-partition fg42/monitors 2))) - -(defun monitor (mon) - "Switch to the given monitor resolution profile MON." - (interactive - (list (completing-read - "Monitor Profole: " - (monitor-profiles)))) - - (let ((cmd (mapconcat (lambda (x) (format "xrandr %s" x)) - (plist-get fg42/monitors (intern (format "%s" mon))) - " && "))) - (message "Setting monitor profile: %s" cmd) - (async-shell-command cmd "*xrandr*"))) - -(provide 'fg42/x) -;;; x.el ends here diff --git a/lisp/fpkg.el b/lisp/fpkg.el deleted file mode 100644 index 0bc5bf6..0000000 --- a/lisp/fpkg.el +++ /dev/null @@ -1,69 +0,0 @@ -;;; fpkg --- a simple package manager for FG42 -*- lexical-binding: t; -*- -;; -;; Copyright (C) 2010-2024 Sameer Rahmani -;; -;; Author: Sameer Rahmani -;; Keywords: lisp fg42 IDE package manager -;; Version: 1.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: -;; -;; Simple package manager for FG42 -;; -;;; Code: -(require 'map) - -(defvar package-names ()) - -(eval-when-compile - (defvar fg42/disabled-features '()) - (require 'use-package)) - - -(defun inject-params (args) - "Inject required `use-package' params to ARGS if the key is missing." - ;; (if (member :defer args) - ;; (append '(:ensure nil) args) - (append args '(:ensure nil))) - - -(defmacro fpkg/use (pkg &rest details) - "Install the given package DETAILS PKG via `use-package' and straight." - (declare (indent defun)) - (if (and (listp details) (< 0 (length details))) - (let ((p (inject-params details))) - `(progn - (use-package ,pkg ,@p))) - `(progn - (use-package ,pkg :defer t :ensure nil)))) - - -(defmacro use! (pkg docs &rest details) - "Loading the given package DETAILS PKG via `use-package'. - -DOCS is the documentation of the package." - (declare (indent defun) (doc-string 2)) - - (when (not (stringp docs)) - (error "Missing docstring for '%s' package" pkg)) - - (let ((disabled (or (member pkg fg42/disabled-features) nil))) - (when (not disabled) - `(use-package ,pkg ,@details)))) - - -(provide 'fpkg) -;;; fpkg.el ends here diff --git a/lisp/fpkg/core.el b/lisp/fpkg/core.el deleted file mode 100644 index c09cf83..0000000 --- a/lisp/fpkg/core.el +++ /dev/null @@ -1,66 +0,0 @@ -;;; fpkg --- a simple package manager for FG42 -*- lexical-binding: t; -*- -;; -;; Copyright (C) 2010-2024 Sameer Rahmani -;; -;; Author: Sameer Rahmani -;; Keywords: lisp fg42 IDE package manager -;; Version: 1.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: -;; -;; Simple package manager for FG42 -;; -;;; Code: -(require 'fg42/core) - - -(defvar bootstrap-version 5) - - -(defun fpkg/install-and-load-use-package () - "Install and load the `use-package' in compile time." - ;; TODO Enable use-package on compile time - ;;(eval-when-compile) - - (if fg42-use-nix - (setq use-package-always-ensure nil) - (progn - (setq use-package-always-ensure t) - (straight-use-package 'use-package))) - (require 'use-package)) - - - -(defun fpkg/initialize () - "Initialize FPKG." - (if (null fg42-use-nix) - (let ((bootstrap-file - (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))) - - (unless (file-exists-p bootstrap-file) - (with-current-buffer - (url-retrieve-synchronously - "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el" - 'silent 'inhibit-cookies) - (goto-char (point-max)) - (eval-print-last-sexp))) - (load bootstrap-file nil 'nomessage) - (fpkg/install-and-load-use-package)) - (fpkg/install-and-load-use-package))) - - -(provide 'fpkg/core) -;;; core.el ends here diff --git a/lisp/ob-graphviz-dot.el b/lisp/ob-graphviz-dot.el deleted file mode 100644 index 99bb764..0000000 --- a/lisp/ob-graphviz-dot.el +++ /dev/null @@ -1,85 +0,0 @@ -;;; ob-gharphviz --- org-babel functions for gharphviz evaluation of FG42 -;; -;; Copyright (c) 2010-2024 Sameer Rahmani & Contributors -;; -;; Author: Sameer Rahmani -;; URL: https://devheroes.codes/FG42/FG42 -;; Version: 4.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: - -;; This file location is important and can't be under `fg42/' dir even -;; though it is part of the FG42. That's due to the `org-babel' mechanism -;; to automatically load the language backend. SO DO NOT MOVE IT. - -;;; Code: -(require 'ob) -(require 'ob-ref) -(require 'ob-comint) -(require 'ob-eval) -(require 'ob-dot) - - -(add-to-list 'org-babel-tangle-lang-exts '("graphviz-dot" . "dot")) - -(defvar org-babel-default-header-args:graphviz-dot - '((:results . "file") (:exports . "results"))) - -(defun org-babel-expand-body:ghraphviz-dot (body params &optional processed-params) - "Expand BODY according to PARAMS, return the expanded body." - (let ((vars (org-babel--get-vars params))) - (mapc - (lambda (pair) - (let ((name (symbol-name (car pair))) - (value (cdr pair))) - (setq body - (replace-regexp-in-string - (concat "$" (regexp-quote name)) - (if (stringp value) value (format "%S" value)) - body - t - t)))) - vars) - body)) - -(defun org-babel-execute:graphviz-dot (body params) - "Execute a block of Template code with org-babel. -This function is called by `org-babel-execute-src-block'" - (let* ((out-file (cdr (or (assq :file params) - (error "You need to specify a :file parameter")))) - (cmdline (or (cdr (assq :cmdline params)) - (format "-T%s" (file-name-extension out-file)))) - (cmd (or (cdr (assq :cmd params)) "dot")) - (coding-system-for-read 'utf-8) ;use utf-8 with sub-processes - (coding-system-for-write 'utf-8) - (in-file (org-babel-temp-file "dot-"))) - (with-temp-file in-file - (insert (org-babel-expand-body:dot body params))) - (org-babel-eval - (concat cmd - " " (org-babel-process-file-name in-file) - " " cmdline - " -o " (org-babel-process-file-name out-file)) "") - ;; signal that output has already been written to file - nil)) - - -(defun org-babel-prep-session:graphviz-dot (session params) - "Prepare SESSION according to the header arguments specified in PARAMS." - (error "Dot does not support sessions")) - -(provide 'ob-graphviz-dot) -;;; ob-graphviz-dot.el ends here diff --git a/nix/modules/wm/lisp/fg42/wm.el b/nix/modules/wm/lisp/fg42/wm.el index 9e5f1d4..5b19f28 100644 --- a/nix/modules/wm/lisp/fg42/wm.el +++ b/nix/modules/wm/lisp/fg42/wm.el @@ -86,7 +86,7 @@ (message "[FG42]: Starting the window manager.") (require 'exwm-config) ;; Set the initial number of workspaces (they can also be created later). - (setq exwm-workspace-number 10) + (setq exwm-workspace-number 9) ;; All buffers created in EXWM mode are named "*EXWM*". You may want to ;; change it in `exwm-update-class-hook' and `exwm-update-title-hook', which