Try to add emojify as an optional feature

This commit is contained in:
Sameer Rahmani 2024-04-15 20:25:14 +01:00
parent 906fe2fb8d
commit 7368622086
Signed by: lxsameer
GPG Key ID: 8741FACBF412FFA5
7 changed files with 82 additions and 47 deletions

View File

@ -21,29 +21,37 @@
# A list of default FG42 modules to build FG42 with.
{ lib, config, pkgs, makeFG42Drv, ... }:
let
deps = (with pkgs.emacsPackages; [
origami
which-key
projectile
projectile-ripgrep
pkg-info
expand-region
helpful
envrc
pinentry
discover
exec-path-from-shell
avy
ace-window
yasnippet
yasnippet-snippets
flycheck
vertico
orderless
ctrlf
marginalia
base16-theme
]);
deps =
(with pkgs.emacsPackages; [
origami
which-key
projectile
projectile-ripgrep
pkg-info
expand-region
helpful
envrc
pinentry
discover
exec-path-from-shell
avy
ace-window
yasnippet
yasnippet-snippets
flycheck
vertico
orderless
ctrlf
marginalia
magit
forge
diff-hl
svg-tag-mode
all-the-icons
base16-theme
] ++ lib.optional (config.fg42.emojify) [ emojify ]);
drv = makeFG42Drv {
pname = "editor";
version = config.fg42.version;
@ -54,21 +62,32 @@ let
dicts = pkgs.aspellWithDicts (dicts: with dicts; [ en en-computers en-science ]);
in
{
fg42.elispPackages = [ drv ] ++ deps;
fg42.fonts = (with pkgs;[
vazir-fonts
fira-code
fira-mono
noto-fonts
]);
options = (with lib; {
fg42.emojify = mkOption {
type = types.bool;
default = true;
description = "Whether or not to use the `emojify' package.";
};
});
fg42.paths = (with pkgs;[
ripgrep
dicts
]);
config = {
fg42.elispPackages = [ drv ] ++ deps;
fg42.font = lib.mkDefault '''("Fira Mono" 11)'';
fg42.theme = lib.mkDefault "base16-eighties";
fg42.theme-package-name = lib.mkDefault "base16-theme";
fg42.fonts = (with pkgs;[
vazir-fonts
fira-code
fira-mono
noto-fonts
]);
fg42.paths = (with pkgs;[
ripgrep
dicts
]);
fg42.font = lib.mkDefault '''("Fira Mono" 11)'';
fg42.theme = lib.mkDefault "base16-eighties";
fg42.theme-package-name = lib.mkDefault "base16-theme";
};
}

View File

@ -36,5 +36,13 @@
`,sym
`,default)))
(defmacro with-config (name &rest body)
"Run the BODY only if the config NAME is set to t."
(declare (indent defun))
`(when (fg42/config-get-or ,name)
,@body))
(provide 'fg42/config)
;;; config.el ends here

View File

@ -37,11 +37,11 @@
;; (require 'fg42/langs/elisp)
;; (require 'fg42/langs/nix)
;; (require 'fg42/git)
(require 'fg42/git)
;; (require 'fg42/wm)
;; (require 'fg42/org)
(require 'fg42/org)
(require 'fg42/minibuffer)
;; (require 'fg42/graphics)
(require 'fg42/graphics)
;; (require 'fg42/modeline)
)

View File

@ -22,9 +22,11 @@
;;; Commentary:
;;; Code:
(eval-when-compile
(require 'fpkg))
(require 'fpkg)
(require 'fg42/config))
(use! emojify
(use-with-config! emojify
"Adds support for emojis to `FG42'"
:if (display-graphic-p)
:hook (emacs-startup . global-emojify-mode))
@ -34,11 +36,6 @@
Emacs."
:if (display-graphic-p))
(use! nerd-icons
"A utility package to collect various Icon Fonts and propertize them within
Emacs."
:if (display-graphic-p))
(use! svg-tag-mode
"A minor mode to replace keywords or regular expression with SVG tags."

View File

@ -25,6 +25,8 @@
;;
;;; Code:
(require 'map)
(eval-when-compile
(require 'fg42-config))
(defvar package-names ())
@ -63,5 +65,14 @@ DOCS is the documentation of the package."
`(use-package ,pkg ,@details))))
(defmacro use-with-config! (name docs &rest details)
"A wrapper around `use!' that only activates if a config NAME is set.
It passes NAME, DOCS, and DETAILS to `use!' only if a config with the
same NAME is set to t."
(declare (indent defun) (doc-string 2))
`(with-config ,name
(use! ,name ,docs ,@details)))
(provide 'fpkg)
;;; fpkg.el ends here