From b02a98a0df668fbcf6e93cf7f73ab225970199fa Mon Sep 17 00:00:00 2001 From: Timo Wilken Date: Fri, 1 Dec 2023 20:14:55 +0100 Subject: Fix .asd finding function --- tw/home/files/emacs-init.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'tw/home/files') diff --git a/tw/home/files/emacs-init.el b/tw/home/files/emacs-init.el index 72c75799..a924db56 100644 --- a/tw/home/files/emacs-init.el +++ b/tw/home/files/emacs-init.el @@ -873,9 +873,13 @@ For use in `org-latex-classes'." (defun tw/find-asd-systems (directory) "Return a list of Common Lisp .asd systems found in DIRECTORY." (let ((asd-rx (rx ".asd" eos))) - (mapcar (lambda (file) - (string-trim-right file asd-rx)) - (directory-files directory nil asd-rx)))) + ;; `locate-dominating-file' will call this function once with the original + ;; file name as DIRECTORY, but `directory-files' fails if its argument is + ;; a regular file, so protect against this. + (and (directory-name-p directory) + (mapcar (lambda (file) + (string-trim-right file asd-rx)) + (directory-files directory nil asd-rx))))) (defun tw/lisp-project-setup () "Set up a Lisp REPL for the current project." -- cgit v1.2.3