Commit dd4500483997

Vincent Demeester <vincent@sbr.pm>
2020-08-10 15:27:00
tools/emacs: use const for fonts ๐Ÿ˜‰
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent c00d31c
Changed files (3)
tools/emacs/config/config-appearance.el
@@ -13,16 +13,16 @@
   (defun mu-reset-fonts ()
     "Reset fonts to my preferences."
     (interactive)
-    (when (member "Ubuntu Mono" (font-family-list))
+    (when (member font-family-mono (font-family-list))
       (set-face-attribute 'default nil
-                          :family "Ubuntu Mono"
+                          :family font-family-mono
                           :height font-height)
       (set-face-attribute 'fixed-pitch nil
-                          :family "Ubuntu Mono"
+                          :family font-family-mono
                           :height font-height))
-    (when (member "Ubuntu Sans" (font-family-list))
+    (when (member font-family-sans (font-family-list))
       (set-face-attribute 'variable-pitch nil
-                          :family "Ubuntu Sans"
+                          :family font-family-sans
                           :height font-height
                           :weight 'regular))))
 ;; -TypeFaceConfiguration
tools/emacs/early-init.el
@@ -3,6 +3,7 @@
 ;; :header-args: :tangle ~/src/home/tools/emacs/early-init.el
 ;; :header-args+: :comments org
 ;; :CUSTOM_ID: h:ec67a339-378c-4c2c-93f8-9ce62308cccb
+;; :ID:       317fc8fd-1220-423d-8a45-497f951014ee
 ;; :END:
 ;; 
 ;; Starting with Emacs 27, an =early-init.el= file can be used to do early configuration
@@ -128,6 +129,10 @@ This is used internally by `sbr/modus-themes-toggle'."
 
 (defconst font-height 130
   "Default font-height to use.")
+(defconst font-family-mono "Ubuntu Mono"
+  "Default monospace font-family to use.")
+(defconst font-family-sans "Ubuntu Sans"
+  "Default sans font-family to use.")
 ;; Middle/Near East: ืฉืœื•ื, ุงู„ุณู‘ู„ุงู… ุนู„ูŠูƒู…
 (when (member "Noto Sans Arabic" (font-family-list))
   (set-fontset-font t 'arabic "Noto Sans Arabic"))
@@ -137,18 +142,17 @@ This is used internally by `sbr/modus-themes-toggle'."
 (when (member "Noto Sans Ethiopic" (font-family-list))
   (set-fontset-font t 'ethiopic "Noto Sans Ethiopic"))
 
-;; Default font is Ubuntu Mono (and Ubuntu Sans for variable-pitch)
-;; If Ubuntu Mono or Ubuntu Sans are not available, use the default Emacs face
-(when (member "Ubuntu Mono" (font-family-list))
+;; If font-family-mono or font-family-sans are not available, use the default Emacs face
+(when (member font-family-mono (font-family-list))
   (set-face-attribute 'default nil
-                      :family "Ubuntu Mono"
+                      :family font-family-mono
                       :height font-height)
   (set-face-attribute 'fixed-pitch nil
-                      :family "Ubuntu Mono"
+                      :family font-family-mono
                       :height font-height))
-(when (member "Ubuntu Sans" (font-family-list))
+(when (member font-family-sans (font-family-list))
   (set-face-attribute 'variable-pitch nil
-                      :family "Ubuntu Sans"
+                      :family font-family-sans
                       :height font-height
                       :weight 'regular))
 
tools/emacs/init.el
@@ -1,6 +1,7 @@
 ;; Initialization
 ;; :PROPERTIES:
 ;; :CUSTOM_ID: h:1bb5a9c1-0629-4428-bd2c-73a5fbd968b9
+;; :ID:       a8fe7fee-d339-4854-9b75-c627adce788a
 ;; :END:
 ;; 
 ;; I am using the [[https://archive.casouri.cat/note/2020/painless-transition-to-portable-dumper/index.html][portable dump]] feature (/to speed things up/) *but* I want to also start
@@ -91,6 +92,7 @@
 ;; Unicode all the way
 ;; :PROPERTIES:
 ;; :CUSTOM_ID: h:df45a01a-177d-4909-9ce7-a5423e0ea20f
+;; :ID:       e98f57c6-565a-4919-8ecb-f12e939dab03
 ;; :END:
 ;; 
 ;; By default, all my systems are configured and support =utf-8=, so let's just make it a
@@ -106,6 +108,7 @@
 ;; Package management with =use-package=
 ;; :PROPERTIES:
 ;; :CUSTOM_ID: h:112262a1-dd4d-4a50-a9e2-85b36bbbd95b
+;; :ID:       d2d75dfe-5085-4655-a81f-b6033f273f6f
 ;; :END:
 ;; 
 ;; =use-package= is a tool that streamlines the configuration of packages. It handles
@@ -181,6 +184,7 @@
 ;; Early environment setup
 ;; :PROPERTIES:
 ;; :CUSTOM_ID: h:859c42d4-876d-43b7-b8c9-8ee2977efb01
+;; :ID:       de0aad38-4742-4601-9fe6-c659ddc76bcb
 ;; :END:
 ;; 
 ;; I want to *force* ==SSH_AUTH_SOCK= in Emacs to use my gpg-agent.
@@ -191,6 +195,7 @@
 ;; =custom.el=
 ;; :PROPERTIES:
 ;; :CUSTOM_ID: h:1ddaf27e-ff7c-424e-8615-dd0bd22b685f
+;; :ID:       afd8123e-1461-4f65-a9b7-c8195f1054c8
 ;; :END:
 ;; 
 ;; When you install a package or use the various customisation interfaces to tweak things to
@@ -217,6 +222,7 @@
 ;; Remove built-in =org-mode=
 ;; :PROPERTIES:
 ;; :CUSTOM_ID: h:9462c0d7-03be-4231-8f22-ce1a04be32b1
+;; :ID:       b2b2ac61-2ce6-4a86-b67c-88592bc0f111
 ;; :END:
 ;; 
 ;; I want to make sure I am using the installed version of =orgmode= (from my org
@@ -234,6 +240,7 @@
 ;; Loading configuration files
 ;; :PROPERTIES:
 ;; :CUSTOM_ID: h:d6aebc56-aadb-4b01-8404-bb922d12f8a8
+;; :ID:       ca8dd6f8-47c1-40bd-932b-baf3fb9e6407
 ;; :END:
 ;; 
 ;; This =org-mode= document /tangles/ into several files in different folders :
@@ -319,6 +326,7 @@
 ;; Counting the time of loading
 ;; :PROPERTIES:
 ;; :CUSTOM_ID: h:2b645e95-6776-4f5b-a318-e5a915943881
+;; :ID:       2c7541e4-ed3c-497a-b078-732d18e82759
 ;; :END: