summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej Barć <xgqt@gentoo.org>2022-08-16 22:27:49 +0200
committerMaciej Barć <xgqt@gentoo.org>2022-08-16 22:27:49 +0200
commit1e1b5295567856865edc8b56859cc5c756f6296a (patch)
tree512ca00ecfd0e9e4fc6c153fb573b4c8ec3b5821
parentcompany-ebuild.el: check if profiles/use.desc exists (diff)
downloadcompany-ebuild-1e1b5295.tar.gz
company-ebuild-1e1b5295.tar.bz2
company-ebuild-1e1b5295.zip
company-ebuild.el: company-ebuild--find-repo-root guards
Signed-off-by: Maciej Barć <xgqt@gentoo.org>
-rw-r--r--company-ebuild.el13
1 files changed, 6 insertions, 7 deletions
diff --git a/company-ebuild.el b/company-ebuild.el
index e2c34df..022a058 100644
--- a/company-ebuild.el
+++ b/company-ebuild.el
@@ -139,7 +139,9 @@ For example:
"Return the root directory of current Ebuild repository.
FILE-PATH is the location from which we start searching for repository root."
- (locate-dominating-file file-path "profiles/repo_name"))
+ (and (not (null file-path))
+ (file-exists-p file-path)
+ (locate-dominating-file file-path "profiles/repo_name")))
(defun company-ebuild--find-eclass-files (file-path)
"Return found Eclass files.
@@ -154,8 +156,7 @@ FILE-PATH is the location from which we start searching for Eclass files."
(defun company-ebuild--regenerate-dynamic-keywords-eclasses ()
"Set new content of the ‘company-ebuild--dynamic-keywords’ Eclass variables."
(let ((repo-root
- (and buffer-file-name
- (company-ebuild--find-repo-root buffer-file-name))))
+ (company-ebuild--find-repo-root buffer-file-name)))
(when repo-root
(let ((eclass-files
(company-ebuild--find-eclass-files repo-root)))
@@ -182,8 +183,7 @@ FILE-PATH is the location from which we start searching for Eclass files."
(defun company-ebuild--regenerate-dynamic-keywords-use-flags ()
"Set new content of the ‘company-ebuild--dynamic-keywords-use-flags’ variable."
(let ((repo-root
- (and buffer-file-name
- (company-ebuild--find-repo-root buffer-file-name)))
+ (company-ebuild--find-repo-root buffer-file-name))
(awk-format
"awk -F - '{ print $1 }' %s/profiles/use.desc"))
(when (and repo-root
@@ -207,8 +207,7 @@ FILE-PATH is the location from which we start searching for Eclass files."
(defun company-ebuild--regenerate-dynamic-keywords-licenses ()
"Set new content of the ‘company-ebuild--dynamic-keywords-licenses’ variable."
(let ((repo-root
- (and buffer-file-name
- (company-ebuild--find-repo-root buffer-file-name))))
+ (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))))))