diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2024-08-15 19:00:49 +0100 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2024-08-15 19:01:04 +0100 |
commit | c05bb3a60490e64eb2848e2b14a92eee62d8f79a (patch) | |
tree | e22b2e01d945cddf2555a2a8270ea65df602fa2a /Emacs | |
parent | 217ee9cd00d690a033be5869f1c777eda5b5d6d9 (diff) | |
download | dotfiles-c05bb3a60490e64eb2848e2b14a92eee62d8f79a.tar.gz dotfiles-c05bb3a60490e64eb2848e2b14a92eee62d8f79a.tar.bz2 dotfiles-c05bb3a60490e64eb2848e2b14a92eee62d8f79a.zip |
(Emacs/config)~system-name-cond -> pcase
Does the same thing but is inbuilt.
Diffstat (limited to 'Emacs')
-rw-r--r-- | Emacs/.config/emacs/config.org | 40 |
1 files changed, 8 insertions, 32 deletions
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 |