From 4c72550f0f0a4a71c7381493738233c64ff04091 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Mon, 6 May 2019 17:59:37 +0200 Subject: Clean up in config. --- module/config.scm | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/module/config.scm b/module/config.scm index 6a7358e4..d62b05db 100644 --- a/module/config.scm +++ b/module/config.scm @@ -10,10 +10,20 @@ (ice-9 regex) (ice-9 rdelim)) +(define (p str) + "Pathify string." + (regexp-substitute/global + #f "~[^/]*" str + 'pre (lambda (_) (getenv "HOME")) 'post)) + +(define (filename-hidden? str) + (char=? #\. (string-ref str 0))) + (calendar-files - (let ((path (string-append (getenv "HOME") "/.calendars/"))) + (let ((path #; "/mnt/arch/home/hugo/.calendars/" + (p "~/.calendars/"))) (map (cut string-append path <>) - (scandir path (lambda (str) (not (char=? #\. (string-ref str 0)))))))) + (scandir path (negate filename-hidden?))))) ;;; TODO possibly replace with propper lookup (define my-courses -- cgit v1.2.3