diff options
Diffstat (limited to 'shoshimacs.org')
-rw-r--r-- | shoshimacs.org | 33 |
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 |