aboutsummaryrefslogtreecommitdiff
path: root/shoshimacs.org
diff options
context:
space:
mode:
authorshoshin <shoshin@cicadas.surf>2022-10-12 17:36:45 -0500
committershoshin <shoshin@cicadas.surf>2022-10-12 17:36:45 -0500
commit560513c002952232d41897aa6a47c9e845b93a24 (patch)
treebf725abdf6471f97ca60171b1a35346182250883 /shoshimacs.org
parent88f8e0f139b0c0d81c834501dccde04a0032d55d (diff)
Clean: replace my-hostname with system-name built in
Diffstat (limited to 'shoshimacs.org')
-rw-r--r--shoshimacs.org33
1 files changed, 20 insertions, 13 deletions
diff --git a/shoshimacs.org b/shoshimacs.org
index 3c7bdf6..76c34d8 100644
--- a/shoshimacs.org
+++ b/shoshimacs.org
@@ -85,18 +85,6 @@ set and load a separate file to keep it clean:
(load custom-file))
#+end_src
-*** using a hostname to tweak the config for different machines
-
-I use this config on several machines. Using their individual hostnames,
-I can add conditional configuration for each of them as needed. As an
-example, I use a smaller font size on an older low-resolution laptop.
-
-#+begin_src emacs-lisp
- (defun my-hostname ()
- "Helper function to determine on which host Emacs is starting."
- (string-trim (with-temp-buffer (shell-command "hostname" t) (buffer-string))))
-#+end_src
-
*** shortcuts to this configuration document
I use a special variable to hold the path to this org file in its
@@ -118,6 +106,25 @@ quickly jump to it and reload it.
(org-babel-load-file *my-config*))
#+end_src
+*** using a hostname to tweak the config for different machines
+
+I use this config on several machines. Using their individual hostnames,
+I can add conditional configuration for each of them as needed. As an
+example, I use a smaller font size on an older low-resolution laptop.
+
+Turns out Emacs has the function ~system-name~ to do this.
+Unclear why I couldn't find it at the time I wrote the following function.
+I'm leaving it as a historical example of foolish Elisp hackery. I couldn't
+quickly figure out how to do it via Emacs itself, so I just shelled out
+to the ~hostname~ command (which is probably not going to work on every
+system)
+
+#+begin_src emacs-lisp :tangle no
+ (defun my-hostname ()
+ "Helper function to determine on which host Emacs is starting."
+ (string-trim (with-temp-buffer (shell-command "hostname" t) (buffer-string))))
+#+end_src
+
* Package Management
:PROPERTIES:
:header-args:emacs-lisp+: :noweb-ref package-management :noweb-sep "\n\n" :results silent
@@ -880,7 +887,7 @@ depending on the window layout currently in use.
For code, I've grown fond of Victor Mono.
#+begin_src emacs-lisp
- (let ((size (if (or (equal (my-hostname) "zebes") (equal (my-hostname) "ridley")) 14 12)))
+ (let ((size (if (or (equal (system-name) "zebes") (equal (system-name) "ridley")) 14 12)))
(set-frame-font (format "Victor Mono-%s" size)))
#+end_src