summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej Barć <xgqt@gentoo.org>2022-08-26 00:51:33 +0200
committerMaciej Barć <xgqt@gentoo.org>2022-08-26 00:51:33 +0200
commit322ae5cabfecb244dc3c398395ad5dd1e58c5493 (patch)
tree35e3bd4388cfa8eff512f824cd91fc05e4e762e6
parentcompany-ebuild-keywords.el: make most of dynamic vars buffer-local (diff)
downloadcompany-ebuild-322ae5cabfecb244dc3c398395ad5dd1e58c5493.tar.gz
company-ebuild-322ae5cabfecb244dc3c398395ad5dd1e58c5493.tar.bz2
company-ebuild-322ae5cabfecb244dc3c398395ad5dd1e58c5493.zip
company-ebuild.el: fix regeneration of eclasses and licenses
Signed-off-by: Maciej Barć <xgqt@gentoo.org>
-rw-r--r--company-ebuild.el15
1 files 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."