forked from FG42/FG42
Add the :flag-default to editor cubes and nest them inside the editor
This commit is contained in:
parent
08e9826818
commit
dfed2fd5f7
|
@ -25,12 +25,13 @@
|
||||||
(require 'fg42/cube)
|
(require 'fg42/cube)
|
||||||
|
|
||||||
(defflag font-icons
|
(defflag font-icons
|
||||||
"Enable the support for font icones in FG42.")
|
"Enable the support for font icones in FG42." t)
|
||||||
|
|
||||||
|
|
||||||
(defcube fg42/pinentry-cube
|
(defcube fg42/pinentry-cube
|
||||||
(:docs "cubes/fg42/pinentry-cube.org"
|
(:docs "cubes/fg42/pinentry-cube.org"
|
||||||
:flag pinentry)
|
:flag pinentry
|
||||||
|
:flag-default t)
|
||||||
(fpkg/use pinentry
|
(fpkg/use pinentry
|
||||||
:init
|
:init
|
||||||
(progn
|
(progn
|
||||||
|
@ -40,7 +41,8 @@
|
||||||
|
|
||||||
(defcube fg42/exec-path-cube
|
(defcube fg42/exec-path-cube
|
||||||
(:docs "cubes/fg42/exec-path-cube.org"
|
(:docs "cubes/fg42/exec-path-cube.org"
|
||||||
:flag exec-path-from-shell)
|
:flag exec-path-from-shell
|
||||||
|
:flag-default t)
|
||||||
(fpkg/use exec-path-from-shell
|
(fpkg/use exec-path-from-shell
|
||||||
:init
|
:init
|
||||||
(when (memq window-system '(mac ns x))
|
(when (memq window-system '(mac ns x))
|
||||||
|
@ -49,16 +51,21 @@
|
||||||
|
|
||||||
(defcube fg42/cursor-cube
|
(defcube fg42/cursor-cube
|
||||||
(:docs "cubes/fg42/cursor-cube.org"
|
(:docs "cubes/fg42/cursor-cube.org"
|
||||||
:flag cursor-type)
|
:flag cursor-type
|
||||||
|
:flag-default t)
|
||||||
(let ((ctype (or (plist-get fg42/cursor-cube-params :type) 'box))
|
(let ((ctype (or (plist-get fg42/cursor-cube-params :type) 'box))
|
||||||
(ccolor (or (plist-get fg42/cursor-cube-params :color) "#aa0000")))
|
(ccolor (or (plist-get fg42/cursor-cube-params :color) "#aa0000")))
|
||||||
|
|
||||||
|
(add-hook 'fg42/after-initializing-theme-hook
|
||||||
|
(lambda ()
|
||||||
(set-default 'cursor-type ctype)
|
(set-default 'cursor-type ctype)
|
||||||
(set-cursor-color ccolor)))
|
(set-cursor-color ccolor)))))
|
||||||
|
|
||||||
|
|
||||||
(defcube fg42/buffer-navigation-cube
|
(defcube fg42/buffer-navigation-cube
|
||||||
(:docs "cubes/fg42/buffer-navigation-cube.org"
|
(:docs "cubes/fg42/buffer-navigation-cube.org"
|
||||||
:flag buffer-navigation)
|
:flag buffer-navigation
|
||||||
|
:flag-default t)
|
||||||
|
|
||||||
(fpkg/use avy
|
(fpkg/use avy
|
||||||
:bind ("M-1" . avy-goto-word-1)))
|
:bind ("M-1" . avy-goto-word-1)))
|
||||||
|
@ -66,7 +73,8 @@
|
||||||
|
|
||||||
(defcube fg42/window-navigation-cube
|
(defcube fg42/window-navigation-cube
|
||||||
(:docs "cubes/fg42/window-navigation-cube.org"
|
(:docs "cubes/fg42/window-navigation-cube.org"
|
||||||
:flag window-navigation)
|
:flag window-navigation
|
||||||
|
:flag-default t)
|
||||||
|
|
||||||
(fpkg/use ace-window
|
(fpkg/use ace-window
|
||||||
:bind ("C-<tab>" . ace-window)))
|
:bind ("C-<tab>" . ace-window)))
|
||||||
|
@ -74,7 +82,8 @@
|
||||||
|
|
||||||
(defcube fg42/font-cube
|
(defcube fg42/font-cube
|
||||||
(:docs "cubes/fg42/font-cube.org"
|
(:docs "cubes/fg42/font-cube.org"
|
||||||
:no-flag t)
|
:no-flag t
|
||||||
|
:flag-default t)
|
||||||
|
|
||||||
(let ((font (or (plist-get fg42/font-cube-params :font-name)
|
(let ((font (or (plist-get fg42/font-cube-params :font-name)
|
||||||
"Fira Mono"))
|
"Fira Mono"))
|
||||||
|
@ -89,9 +98,12 @@
|
||||||
(defcube fg42/dracula-theme-cube
|
(defcube fg42/dracula-theme-cube
|
||||||
(:docs "cubes/fg42/dracula-theme-cube.org"
|
(:docs "cubes/fg42/dracula-theme-cube.org"
|
||||||
:no-flag t)
|
:no-flag t)
|
||||||
|
(require 'fg42/themes)
|
||||||
|
|
||||||
|
|
||||||
(fpkg/use dracula-theme
|
(fpkg/use dracula-theme
|
||||||
:init
|
:init
|
||||||
(progn
|
(fg42/setup-theme
|
||||||
(load-theme 'dracula t)
|
(load-theme 'dracula t)
|
||||||
(custom-theme-set-faces
|
(custom-theme-set-faces
|
||||||
'dracula
|
'dracula
|
||||||
|
@ -105,7 +117,8 @@
|
||||||
|
|
||||||
(defcube fg42/selectrum-cube
|
(defcube fg42/selectrum-cube
|
||||||
(:docs "cubes/fg42/editor-cube.org"
|
(:docs "cubes/fg42/editor-cube.org"
|
||||||
:flag selectrum)
|
:flag selectrum
|
||||||
|
:flag-default t)
|
||||||
(fpkg/use selectrum
|
(fpkg/use selectrum
|
||||||
:defer nil
|
:defer nil
|
||||||
:init
|
:init
|
||||||
|
@ -176,7 +189,18 @@
|
||||||
(add-hook 'before-save-hook 'delete-trailing-whitespace)
|
(add-hook 'before-save-hook 'delete-trailing-whitespace)
|
||||||
|
|
||||||
;; Enable rainbow-delimiters for programming
|
;; Enable rainbow-delimiters for programming
|
||||||
(add-hook 'prog-mode-hook #'rainbow-delimiters-mode))
|
(add-hook 'prog-mode-hook #'rainbow-delimiters-mode)
|
||||||
|
|
||||||
|
|
||||||
|
;; Call the editor related cubes. They will be run only if
|
||||||
|
;; their flag is active otherwise they will be skipped
|
||||||
|
(fg42/font-cube)
|
||||||
|
(fg42/pinentry-cube)
|
||||||
|
(fg42/exec-path-cube)
|
||||||
|
(fg42/buffer-navigation-cube)
|
||||||
|
(fg42/window-navigation-cube)
|
||||||
|
(fg42/selectrum-cube)
|
||||||
|
(fg42/cursor-cube))
|
||||||
|
|
||||||
|
|
||||||
(provide 'cubes/editor)
|
(provide 'cubes/editor)
|
||||||
|
|
|
@ -27,7 +27,8 @@
|
||||||
;; TODO: Break this into two cubes
|
;; TODO: Break this into two cubes
|
||||||
(defcube fg42/modeline-cube
|
(defcube fg42/modeline-cube
|
||||||
(:docs "cubes/fg42/modeline-cube.org"
|
(:docs "cubes/fg42/modeline-cube.org"
|
||||||
:flag smart-mode-line)
|
:flag smart-mode-line
|
||||||
|
:flag-default t)
|
||||||
|
|
||||||
(fpkg/use smart-mode-line
|
(fpkg/use smart-mode-line
|
||||||
:straight (smart-mode-line :source melpa)
|
:straight (smart-mode-line :source melpa)
|
||||||
|
|
|
@ -105,7 +105,7 @@
|
||||||
|
|
||||||
;; This way we can bypass the flag system if we really really want to.
|
;; This way we can bypass the flag system if we really really want to.
|
||||||
(defun ,cube-name-internal (params)
|
(defun ,cube-name-internal (params)
|
||||||
(when (not (boundp (quote ,active-var)))
|
(if (not (boundp (quote ,active-var)))
|
||||||
(progn
|
(progn
|
||||||
;; Mark this cube as active
|
;; Mark this cube as active
|
||||||
(setq ,active-var t)
|
(setq ,active-var t)
|
||||||
|
@ -122,7 +122,8 @@
|
||||||
(let ((result (progn ,@body)))
|
(let ((result (progn ,@body)))
|
||||||
;; Run the post init hook
|
;; Run the post init hook
|
||||||
(run-hooks (quote ,post-init-hook))
|
(run-hooks (quote ,post-init-hook))
|
||||||
result))))
|
result))
|
||||||
|
(message "[SKIP] The '%s' cube is already active." ',cube-name)))
|
||||||
|
|
||||||
(defun ,cube-name (&rest params)
|
(defun ,cube-name (&rest params)
|
||||||
(interactive)
|
(interactive)
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
;;; Themes --- Theme library of FG42 -*- lexical-binding: t; -*-
|
||||||
|
;;
|
||||||
|
;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors
|
||||||
|
;;
|
||||||
|
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||||
|
;; URL: https://gitlab.com/FG42/FG42
|
||||||
|
;; Version: 3.0.0
|
||||||
|
;;
|
||||||
|
;; This program is free software; you can redistribute it and/or modify
|
||||||
|
;; it under the terms of the GNU General Public License as published by
|
||||||
|
;; the Free Software Foundation, either version 3 of the License, or
|
||||||
|
;; (at your option) any later version.
|
||||||
|
;;
|
||||||
|
;; This program is distributed in the hope that it will be useful,
|
||||||
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
;; GNU General Public License for more details.
|
||||||
|
;;
|
||||||
|
;; You should have received a copy of the GNU General Public License
|
||||||
|
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
;;
|
||||||
|
;;; 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:
|
||||||
|
(require 'fg42/utils)
|
||||||
|
|
||||||
|
(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
|
||||||
|
(run-hooks 'fg42/before-initializing-theme-hook)
|
||||||
|
,@body
|
||||||
|
(run-hooks 'fg42/after-initializing-theme-hook)))
|
||||||
|
|
||||||
|
|
||||||
|
(provide 'fg42/themes)
|
||||||
|
;;; themes.el ends here
|
Loading…
Reference in New Issue