1.1--- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2+++ b/emacs/util.el Wed Oct 25 23:09:16 2023 -0400
1.3@@ -0,0 +1,25 @@
1.4+;;; std/util.el --- standard utils -*- lexical-binding: t -*-
1.5+
1.6+;;; Code:
1.7+(require 'cl-lib)
1.8+
1.9+(defmacro when-sys= (name body)
1.10+ "(when (string= (system-name) NAME) BODY)"
1.11+ `(when ,(string= (system-name) name) ,body))
1.12+
1.13+(defun add-to-load-path (&rest paths)
1.14+ "Add PATHS to `load-path'."
1.15+ (mapc (lambda (x)
1.16+ (cond
1.17+ ((listp x) (mapc #'add-to-load-path x))
1.18+ ('_ (cl-pushnew x load-path))))
1.19+ paths))
1.20+
1.21+(defun join-paths (root &rest dirs)
1.22+ "helper function for joining strings to a path."
1.23+ (let ((result root))
1.24+ (cl-loop for dir in dirs do
1.25+ (setq result (concat (file-name-as-directory result) dir)))
1.26+ result))
1.27+
1.28+(provide 'init/util)