From c05bb3a60490e64eb2848e2b14a92eee62d8f79a Mon Sep 17 00:00:00 2001
From: Aryadev Chavali <aryadev@aryadevchavali.com>
Date: Thu, 15 Aug 2024 19:00:49 +0100
Subject: (Emacs/config)~system-name-cond -> pcase

Does the same thing but is inbuilt.
---
 Emacs/.config/emacs/config.org | 40 ++++++++--------------------------------
 1 file changed, 8 insertions(+), 32 deletions(-)

(limited to 'Emacs/.config/emacs')

diff --git a/Emacs/.config/emacs/config.org b/Emacs/.config/emacs/config.org
index 4ccdb39..5410ceb 100644
--- a/Emacs/.config/emacs/config.org
+++ b/Emacs/.config/emacs/config.org
@@ -124,31 +124,7 @@ TO-RUN is evaluated."
                 (interactive)
                 (when ,conditions ,@to-run)))))
 #+end_src
-** System specificity
-A macro that acts as a switch case on ~(system-name)~ so a user can
-write code for multiple hosts.  For me this is for my desktop and
-laptop.  Though there may be an easier solution than this, this seems
-simple enough.
-
-Note the check for the symbol ~otherwise~ which acts as the default
-case.
-#+begin_src emacs-lisp
-(defmacro system-name-cond (&rest pairs)
-  "Switch case on result of function `system-name'.
-
-Each pair in PAIRS is typed as: (string . (forms...)) where the
-string represents the system name to test, and forms being the
-consequence if true. if string is the symbol OTHERWISE, then it
-is considered the default case."
-  `(cond ,@(mapcar
-            #'(lambda (pair)
-                (cl-destructuring-bind (name . body) pair
-                  (if (eq name 'otherwise)
-                      `(t ,@body)
-                    `((string= (system-name) ,name) ,@body))))
-            pairs)))
-#+end_src
-*** Setting number of native jobs
+** Setting number of native jobs
 In [[file:early-init.el][early-init.el]] I set the number of
 native-workers to 4, which isn't necessarily optimal when
 loading/compiling the rest of this file depending on the machine I
@@ -162,10 +138,10 @@ use:
 (use-package comp
   :init
   (setq native-comp-async-jobs-number
-        (system-name-cond
-         ("newboy" 3)
-         ("oldboy" 6)
-         (otherwise 3))))
+        (pcase (system-name)
+          ("newboy" 3)
+          ("oldboy" 6)
+          (_ 3))))
 #+end_src
 ** Clean buffer list
 Clean all buffers except for those in ~+oreo/keep-buffers~.
@@ -302,9 +278,9 @@ Make font size bigger on my laptop and smaller on my desktop.
   :defer t
   :config
   (set-face-attribute 'default nil :height
-                      (system-name-cond
-                       ("newboy" 145)
-                       ("oldboy" 135))))
+                      (pcase (system-name)
+                        ("newboy" 145)
+                        ("oldboy" 135))))
 #+end_src
 ** Startup screen
 The default startup screen is quite bad in all honesty.  While for a
-- 
cgit v1.2.3-13-gbd6f