commit:     322ae5cabfecb244dc3c398395ad5dd1e58c5493
Author:     Maciej Barć <xgqt <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 25 22:51:33 2022 +0000
Commit:     Maciej Barć <xgqt <AT> gentoo <DOT> org>
CommitDate: Thu Aug 25 22:51:33 2022 +0000
URL:        
https://gitweb.gentoo.org/proj/company-ebuild.git/commit/?id=322ae5ca

company-ebuild.el: fix regeneration of eclasses and licenses

Signed-off-by: Maciej Barć <xgqt <AT> gentoo.org>

 company-ebuild.el | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/company-ebuild.el b/company-ebuild.el
index 30f564a..f67a63e 100644
--- a/company-ebuild.el
+++ b/company-ebuild.el
@@ -145,9 +145,11 @@ FILE-PATH is the location from which we start searching 
for repository root."
   "Return found Eclass files.
 
 REPO-ROOT is the location from which we start searching for Eclass files."
-  (and repo-root
-       (directory-files
-        (expand-file-name "eclass" repo-root) t ".*\\.eclass" t)))
+  (when repo-root
+    (let ((repo-eclass
+           (expand-file-name "eclass" repo-root)))
+      (when (file-exists-p repo-eclass)
+        (directory-files repo-eclass t ".*\\.eclass" t)))))
 
 (defun company-ebuild--regenerate-dynamic-keywords-eclass ()
   "Set new content of the ‘company-ebuild--dynamic-keywords’ Eclass variables."
@@ -199,8 +201,11 @@ REPO-ROOT is the location from which we start searching 
for Eclass files."
   (let ((repo-root
          (company-ebuild--find-repo-root buffer-file-name)))
     (when repo-root
-      (setq company-ebuild--dynamic-keywords-licenses
-            (directory-files (expand-file-name "licenses" repo-root))))))
+      (let ((repo-licenses
+             (expand-file-name "licenses" repo-root)))
+        (when (file-exists-p repo-licenses)
+          (setq company-ebuild--dynamic-keywords-licenses
+                (directory-files repo-licenses)))))))
 
 (defun company-ebuild--regenerate-dynamic-keywords ()
   "Regenerate dynamic keywords."

Reply via email to