From 98b10b21fcee5f376437cd3a0952763032c28310 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Mon, 7 Jul 2025 14:58:05 -0700 Subject: oni-core: Recursively list project directories that are safe These are all project directories that are written by me, either for personal projects or work. None of these should have any dangerous directory local settings. The ‘foreign’ directory is where I keep other people's code that I've either forked for making contributions or for reading the source code. These I may or may not be able to trust. --- oni-core.el | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/oni-core.el b/oni-core.el index c94bb6b..a62f8ef 100644 --- a/oni-core.el +++ b/oni-core.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2025.0707.112734 +;; Version: 2025.0707.145555 ;; Package-Requires: (oni-data-dir oni-embrace oni-hydra expand-region multiple-cursors gcmh diminish ws-butler which-key insert-char-preview mixed-pitch ace-window vertico marginalia orderless consult embark docstr mini-frame) ;; This program is free software; you can redistribute it and/or modify @@ -539,11 +539,18 @@ which normally have their errors suppressed." (skip-syntax-forward "> ") (ensure-empty-lines)))) +(defun oni-core--without-dangerous-directories (directory) + "Call ‘directory-files' on DIRECTORY, but remove certain directories." + (cl-delete-if + (lambda (d) (string-match-p (rx "/" (or "." ".." "foreign" ".git") eos) d)) + (directory-files directory t))) + (if (boundp 'safe-local-variable-directories) (setq safe-local-variable-directories - (cl-delete-if - (lambda (d) (string-match-p (rx "/" (or "." ".." "foreign") eos) d)) - (directory-files "~/code/" t)))) + (apply 'append (mapcar + (lambda (d) + (oni-core--without-dangerous-directories d)) + (oni-core--without-dangerous-directories "~/code/"))))) ;;; Space cycling -- cgit v1.3-2-g0d8e