aboutsummaryrefslogtreecommitdiff
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
parent88f8e0f139b0c0d81c834501dccde04a0032d55d (diff)
Clean: replace my-hostname with system-name built in
-rw-r--r--shoshimacs.el10
-rw-r--r--shoshimacs.org33
2 files changed, 25 insertions, 18 deletions
diff --git a/shoshimacs.el b/shoshimacs.el
index 10d107f..ae46dbd 100644
--- a/shoshimacs.el
+++ b/shoshimacs.el
@@ -7,10 +7,6 @@
(setq custom-file my-custom-file)
(load custom-file))
-(defun my-hostname ()
- "Helper function to determine on which host Emacs is starting."
- (string-trim (with-temp-buffer (shell-command "hostname" t) (buffer-string))))
-
(defvar *my-config* "~/projects/shoshimacs/shoshimacs.org"
"Path to my main configuration file.")
@@ -24,6 +20,10 @@
(interactive)
(org-babel-load-file *my-config*))
+(defun my-hostname ()
+ "Helper function to determine on which host Emacs is starting."
+ (string-trim (with-temp-buffer (shell-command "hostname" t) (buffer-string))))
+
(defvar my-themes-to-install
'(cyberpunk-theme dracula-theme nano-theme ef-themes)
"List of themes to install when loading shoshimacs config.")
@@ -252,7 +252,7 @@
(package-install 'darkroom)
-(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)))
(global-hl-line-mode t)
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