-
-
Save dmitrym0/9e81b746136a538ed5e65fb047433b05 to your computer and use it in GitHub Desktop.
init.org
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; ----- | |
(define files-examined-count 0) | |
(define blacklist '("daily")) | |
(define whitelist '("org")) | |
(define (get-extension path) | |
(let ((parts (string-split path "."))) | |
(if (> (length parts) 1) | |
(car (reverse parts)) | |
""))) | |
(define (is-blacklisted? path blacklist) | |
(cond ((null? blacklist) #f) | |
((string-contains? path (car blacklist)) #t) ; Check for partial match | |
(else (is-blacklisted? path (cdr blacklist))))) | |
(define (is-whitelisted? extension whitelist) | |
(cond ((null? whitelist) #f) | |
((string=? extension (car whitelist)) #t) | |
(else (is-whitelisted? extension (cdr whitelist))))) | |
(define (sync-ignore-file path) | |
(set! files-examined-count (+ files-examined-count 1)) ; Increment global counter | |
(log-debug (format "-- Examining file ~s" path)) | |
(let ((extension (get-extension path))) | |
(cond | |
((is-blacklisted? path blacklist) | |
(log-debug (format "-- Ignoring file ~s as it is blacklisted" path)) | |
#t) | |
((not (is-whitelisted? extension whitelist)) | |
(log-debug (format "-- Ignoring file ~s due to unsupported extension: ~s" path extension)) | |
#t) | |
(else | |
(log-debug (format "-- File ~s is accepted for processing" path)) | |
#f)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment