Commit 1d1db7da6c50

Vincent Demeester <vincent@sbr.pm>
2020-02-14 16:57:01
Add host/* files and loading
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent c3e3dc1
host/naruhodo.el
@@ -0,0 +1,1 @@
+../../sync/emacs/naruhodo.el
\ No newline at end of file
host/README.org
@@ -0,0 +1,1 @@
+Put stuff here that are local to a specific machine, those are private, aka not shared via this git repository.
host/wakasu.el
@@ -0,0 +1,1 @@
+../../sync/emacs/wakasu.el
\ No newline at end of file
.gitignore
@@ -29,4 +29,6 @@ projectile-bookmarks.eld
 
 # publishing
 publish.el
-sitemap.org
\ No newline at end of file
+sitemap.org
+
+# private
emacs.org
@@ -369,6 +369,19 @@
 (vde/el-load-dir (concat user-emacs-directory "/config/"))
 #+end_src
 
+Finally, I want to be able to load files for a specific machine, in case I need it (not
+entirely sure why yet but…)
+
+#+begin_src emacs-lisp :tangle init.el
+(defun vde/short-hostname ()
+  "Return hostname in short (aka wakasu.local -> wakasu)"
+  (string-match "[0-9A-Za-z-]+" system-name)
+  (substring system-name (match-beginning 0) (match-end 0)))
+
+(if (file-exists-p (downcase (concat my-init-directory "/hosts/" (my-short-hostname) ".el")))
+    (load-file (downcase (concat my-init-directory "/hosts/" (my-short-hostname) ".el"))))
+#+end_src
+
 
 * TODO Selection candidates and search methods
 :PROPERTIES:
init.el
@@ -99,6 +99,14 @@
 (vde/el-load-dir (concat user-emacs-directory "/lisp/"))
 (vde/el-load-dir (concat user-emacs-directory "/config/"))
 
+(defun vde/short-hostname ()
+  "Return hostname in short (aka wakasu.local -> wakasu)"
+  (string-match "[0-9A-Za-z-]+" system-name)
+  (substring system-name (match-beginning 0) (match-end 0)))
+
+(if (file-exists-p (downcase (concat my-init-directory "/hosts/" (my-short-hostname) ".el")))
+    (load-file (downcase (concat my-init-directory "/hosts/" (my-short-hostname) ".el"))))
+
 (use-package exec-path-from-shell       ; Set up environment variables
   :if (display-graphic-p)
   :unless (eq system-type 'windows-nt)