commit: 1e1b5295567856865edc8b56859cc5c756f6296a Author: Maciej Barć <xgqt <AT> gentoo <DOT> org> AuthorDate: Tue Aug 16 20:27:49 2022 +0000 Commit: Maciej Barć <xgqt <AT> gentoo <DOT> org> CommitDate: Tue Aug 16 20:27:49 2022 +0000 URL: https://gitweb.gentoo.org/proj/company-ebuild.git/commit/?id=1e1b5295
company-ebuild.el: company-ebuild--find-repo-root guards Signed-off-by: Maciej Barć <xgqt <AT> gentoo.org> company-ebuild.el | 13 ++++++------- 1 file 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))))))