Don't call match-string if no match was found

This commit is contained in:
Benson Chu 2024-05-20 16:47:27 -05:00
parent 101d502131
commit 77d09dd714

View file

@ -141,11 +141,10 @@
(defun projectile-dont-switch-when-conf-available (x)
(if-let ((dir (lls/conf-get-safe 'root-dir))
(tools-dir
(progn
(string-match (rx line-start
"/scratch"
(group "/benson/tools" (+ (not "/")) "/"))
dir)
(when (string-match (rx line-start
"/scratch"
(group "/benson/tools" (* (not "/")) "/"))
dir)
(match-string 1 dir))))
(remove-if #'(lambda (path)
(and (string-match-p (rx "/benson/tools")