Unify the fg42/config macros to follow the same naming convention
This commit is contained in:
parent
1531f31d62
commit
741bb46566
|
@ -25,7 +25,7 @@
|
|||
(require 'fpkg)
|
||||
(require 'fg42/config))
|
||||
|
||||
(fg42/config-when "completion-backend" "company"
|
||||
(config-when "completion-backend" "company"
|
||||
(use! company
|
||||
"Company is a modular text completion framework for GNU Emacs."
|
||||
:hook (emacs-startup . global-company-mode)
|
||||
|
@ -56,7 +56,7 @@
|
|||
:hook (company-mode . company-box-mode)))
|
||||
|
||||
|
||||
(fg42/config-when "completion-backend" "corfu"
|
||||
(config-when "completion-backend" "corfu"
|
||||
(use! corfu
|
||||
"Corfu enhances in-buffer completion with a small completion popup.
|
||||
The current candidates are shown in a popup below or above the point. The candidates
|
||||
|
@ -147,7 +147,7 @@ This function is meant to be used with hooks."
|
|||
;; around fixing downstream modules.
|
||||
(interactive)
|
||||
|
||||
(fg42/config-when "completion-backend" "company"
|
||||
(config-when "completion-backend" "company"
|
||||
(company-mode t)))
|
||||
|
||||
|
||||
|
|
|
@ -44,8 +44,8 @@
|
|||
|
||||
(defun fg42/setup-font ()
|
||||
"Set the default font of `FG42' to FONT-NAME and FONT-SIZE."
|
||||
(let ((name (fg42/config-get font-name))
|
||||
(size (fg42/config-get font-size)))
|
||||
(let ((name (config-get font-name))
|
||||
(size (config-get font-size)))
|
||||
|
||||
(add-to-list 'default-frame-alist
|
||||
(cons 'font (format "%s-%d" name size)))
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
:right-fringe 5
|
||||
:poshandler #'fg42/--bottom-right
|
||||
:border-width 0
|
||||
:font (format "%s %s" (fg42/config-get font-name) (- (fg42/config-get font-size) 1))
|
||||
:font (format "%s %s" (config-get font-name) (- (config-get font-size) 1))
|
||||
:border-color "#bd93f9")
|
||||
|
||||
:units
|
||||
|
@ -103,7 +103,7 @@ Appears on the center of the current window."
|
|||
(list
|
||||
:poshandler #'fg42/--bottom-right-padded
|
||||
:border-width 0
|
||||
:font (format "%s %s" (fg42/config-get font-name) (fg42/config-get font-size))
|
||||
:font (format "%s %s" (config-get font-name) (config-get font-size))
|
||||
:border-color "#bd93f9")
|
||||
|
||||
:units
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
(defun fg42-version ()
|
||||
"Return FG42's version."
|
||||
(interactive)
|
||||
(message "FG42 Version %s" (fg42/config-get "version")))
|
||||
(message "FG42 Version %s" (config-get "version")))
|
||||
|
||||
|
||||
(defun fg42-path ()
|
||||
|
|
|
@ -22,14 +22,14 @@
|
|||
;;; Commentary:
|
||||
;;; Code:
|
||||
|
||||
(defmacro fg42/config-get (key)
|
||||
(defmacro config-get (key)
|
||||
"Return the value for KEY or raise an error."
|
||||
(let ((sym (intern (format "fg42/config/%s" key))))
|
||||
(if (boundp sym)
|
||||
`,sym
|
||||
`(error "Can't find config '%s'" ,key))))
|
||||
|
||||
(defmacro fg42/config-get-or (key &optional default)
|
||||
(defmacro config-get-or (key &optional default)
|
||||
"Return the value for KEY or DEFAULT."
|
||||
(let ((sym (intern (format "fg42/config/%s" key))))
|
||||
(if (boundp sym)
|
||||
|
@ -37,12 +37,12 @@
|
|||
`,default)))
|
||||
|
||||
|
||||
(defmacro fg42/config= (key value)
|
||||
(defmacro config= (key value)
|
||||
"Check whether config name KEY has the VALUE or not."
|
||||
`(string= (fg42/config-get-or ,key) ,value))
|
||||
`(string= (config-get-or ,key) ,value))
|
||||
|
||||
|
||||
(defmacro fg42/config-when (key value &rest body)
|
||||
(defmacro config-when (key value &rest body)
|
||||
"Run the BODY only if config KEY has the VALUE."
|
||||
(declare (indent defun))
|
||||
(when (eval `(fg42/config= ,key ,value))
|
||||
|
@ -53,7 +53,7 @@
|
|||
(defmacro with-config (name &rest body)
|
||||
"Run the BODY only if the config NAME is set to t."
|
||||
(declare (indent defun))
|
||||
(if (string= (format "%s" (eval `(fg42/config-get-or ,name ""))) "t")
|
||||
(if (string= (format "%s" (eval `(config-get-or ,name ""))) "t")
|
||||
`(progn
|
||||
,@body)
|
||||
nil))
|
||||
|
@ -62,7 +62,7 @@
|
|||
(defmacro if-config (name then else)
|
||||
"Eval THEN if the config NAME was t, otherwise ELSE."
|
||||
(declare (indent defun))
|
||||
(if (string= (eval `(fg42/config-get-or ,name "")) "t")
|
||||
(if (string= (eval `(config-get-or ,name "")) "t")
|
||||
`,then
|
||||
`,else))
|
||||
|
||||
|
|
|
@ -48,11 +48,11 @@ It executes way before the rest of the cubes.")
|
|||
Load the theme via `use!' and pass the BODY to the `use!' macroro.
|
||||
If the theme name and the theme package name are different the package
|
||||
name can be set via `fg42/theme-package'."
|
||||
`(use! ,(intern (fg42/config-get-or theme-package-name (fg42/config-get theme)))
|
||||
`(use! ,(intern (config-get-or theme-package-name (config-get theme)))
|
||||
"Setting up the ,pkg package."
|
||||
:config
|
||||
(progn
|
||||
(load-theme ',(intern (fg42/config-get theme)) t))))
|
||||
(load-theme ',(intern (config-get theme)) t))))
|
||||
|
||||
|
||||
(provide 'fg42/themes)
|
||||
|
|
Loading…
Reference in New Issue