aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tom Willemse2025-07-07 14:58:05 -0700
committerGravatar Tom Willemse2025-07-07 14:58:05 -0700
commit98b10b21fcee5f376437cd3a0952763032c28310 (patch)
treecb343533e045a2727b58f338d7460372643bd331
parent75fe56293a07c1d260c948116cd1585af3d64f2b (diff)
downloademacs-config-98b10b21fcee5f376437cd3a0952763032c28310.tar.gz
emacs-config-98b10b21fcee5f376437cd3a0952763032c28310.zip
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.
-rw-r--r--oni-core.el15
1 files 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 <tom@ryuslash.org>
;; 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