(Emacs/config)~system-name-cond -> pcase
Does the same thing but is inbuilt.
This commit is contained in:
@@ -124,31 +124,7 @@ TO-RUN is evaluated."
|
|||||||
(interactive)
|
(interactive)
|
||||||
(when ,conditions ,@to-run)))))
|
(when ,conditions ,@to-run)))))
|
||||||
#+end_src
|
#+end_src
|
||||||
** System specificity
|
** Setting number of native jobs
|
||||||
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
|
|
||||||
In [[file:early-init.el][early-init.el]] I set the number of
|
In [[file:early-init.el][early-init.el]] I set the number of
|
||||||
native-workers to 4, which isn't necessarily optimal when
|
native-workers to 4, which isn't necessarily optimal when
|
||||||
loading/compiling the rest of this file depending on the machine I
|
loading/compiling the rest of this file depending on the machine I
|
||||||
@@ -162,10 +138,10 @@ use:
|
|||||||
(use-package comp
|
(use-package comp
|
||||||
:init
|
:init
|
||||||
(setq native-comp-async-jobs-number
|
(setq native-comp-async-jobs-number
|
||||||
(system-name-cond
|
(pcase (system-name)
|
||||||
("newboy" 3)
|
("newboy" 3)
|
||||||
("oldboy" 6)
|
("oldboy" 6)
|
||||||
(otherwise 3))))
|
(_ 3))))
|
||||||
#+end_src
|
#+end_src
|
||||||
** Clean buffer list
|
** Clean buffer list
|
||||||
Clean all buffers except for those in ~+oreo/keep-buffers~.
|
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
|
:defer t
|
||||||
:config
|
:config
|
||||||
(set-face-attribute 'default nil :height
|
(set-face-attribute 'default nil :height
|
||||||
(system-name-cond
|
(pcase (system-name)
|
||||||
("newboy" 145)
|
("newboy" 145)
|
||||||
("oldboy" 135))))
|
("oldboy" 135))))
|
||||||
#+end_src
|
#+end_src
|
||||||
** Startup screen
|
** Startup screen
|
||||||
The default startup screen is quite bad in all honesty. While for a
|
The default startup screen is quite bad in all honesty. While for a
|
||||||
|
|||||||
Reference in New Issue
Block a user