diff options
-rw-r--r-- | shoshimacs.el | 10 | ||||
-rw-r--r-- | shoshimacs.org | 33 |
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 |