From 9c6c3aab5b6bb38b059f12d791ad466379782e11 Mon Sep 17 00:00:00 2001 From: amirrezaask Date: Sun, 23 Feb 2020 19:09:27 +0330 Subject: [PATCH] add fg42-font function and get-fg42-font function to get fg42 font if set by user or the default one --- lib/extensions/editor/init.el | 4 ++-- lib/extensions/editor/utils.el | 1 - lib/fg42/utils.el | 9 +++++++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/extensions/editor/init.el b/lib/extensions/editor/init.el index c7ed6d2..3230ad9 100644 --- a/lib/extensions/editor/init.el +++ b/lib/extensions/editor/init.el @@ -58,8 +58,8 @@ ;; Font Configuration ----------------------------------- (ability fira-font () "Sets the default font to Fira Mono" - (add-to-list 'default-frame-alist '(font . "Fira Mono")) - (set-face-attribute 'default t :font "Fira Mono")) + (add-to-list 'default-frame-alist '(font . (get-fg42-font))) + (set-face-attribute 'default t :font (get-fg42-font))) ;; ------------------------------------------------------ (cheatsheet-add :group '--HELP-- diff --git a/lib/extensions/editor/utils.el b/lib/extensions/editor/utils.el index 05bf886..bb72f13 100644 --- a/lib/extensions/editor/utils.el +++ b/lib/extensions/editor/utils.el @@ -42,5 +42,4 @@ it inserts comment at the end of the line." (interactive) (join-line -1)))) - (provide 'extensions/editor/utils) diff --git a/lib/fg42/utils.el b/lib/fg42/utils.el index 297dd93..4c6137c 100644 --- a/lib/fg42/utils.el +++ b/lib/fg42/utils.el @@ -65,6 +65,15 @@ with is the buffer." "Apply the given FACE-SYMBOL to the given TEXT." (put-text-property 0 (length text) 'face face-symbol text)) +(setq fg42--default-font "Fira Mono") + +(defvar fg42-font "" "FG42 font set by user") + +(defun fg42-font (font) + (setq fg42-font font)) + +(defun get-fg42-font () + (if fg42-font fg42-font fg42--default-font)) (provide 'fg42/utils) ;;; utils.el ends here