summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej Barć <xgqt@gentoo.org>2022-08-20 15:05:16 +0200
committerMaciej Barć <xgqt@gentoo.org>2022-08-20 15:05:16 +0200
commit39424f5d9ff5a79b69e0bf0b5ed2b94e51a90340 (patch)
tree48d1945b52891d43ab0e82818a081e970bb962e7
parentcompany-ebuild.el: rename company-ebuild--regenerate-dynamic-keywords-eclasse... (diff)
downloadcompany-ebuild-39424f5d9ff5a79b69e0bf0b5ed2b94e51a90340.tar.gz
company-ebuild-39424f5d9ff5a79b69e0bf0b5ed2b94e51a90340.tar.bz2
company-ebuild-39424f5d9ff5a79b69e0bf0b5ed2b94e51a90340.zip
company-ebuild-custom.el: add; enable customization of some features from company-ebuild.el
Signed-off-by: Maciej Barć <xgqt@gentoo.org>
-rw-r--r--Cask3
-rw-r--r--Makefile2
-rw-r--r--company-ebuild-custom.el70
-rw-r--r--company-ebuild.el23
4 files changed, 86 insertions, 12 deletions
diff --git a/Cask b/Cask
index 250f6e3..90b5586 100644
--- a/Cask
+++ b/Cask
@@ -2,7 +2,8 @@
(package-file "company-ebuild.el")
-(files "company-ebuild-keywords.el"
+(files "company-ebuild-custom.el"
+ "company-ebuild-keywords.el"
"company-ebuild.el")
(development (depends-on "company")
diff --git a/Makefile b/Makefile
index c89fa82..606ff5d 100644
--- a/Makefile
+++ b/Makefile
@@ -20,7 +20,7 @@ clean:
$(EMACSCMD) --eval "(byte-compile-file \"$(*).el\" 0)"
.PHONY: compile
-compile: company-ebuild-keywords.elc company-ebuild.elc
+compile: company-ebuild-custom.elc company-ebuild-keywords.elc company-ebuild.elc
.PHONY: install
diff --git a/company-ebuild-custom.el b/company-ebuild-custom.el
new file mode 100644
index 0000000..3df3e03
--- /dev/null
+++ b/company-ebuild-custom.el
@@ -0,0 +1,70 @@
+;;; company-ebuild-custom.el --- Company-Ebuild customization -*- lexical-binding: t -*-
+
+
+
+;; Copyright 2022 Gentoo Authors
+
+
+;; This file is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 2 of the License, or
+;; (at your option) any later version.
+
+;; This file is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
+
+
+
+;;; Commentary:
+
+
+;; Company-Ebuild customization.
+
+
+
+;;; Code:
+
+
+(defgroup company-ebuild nil
+ "Company backend for editing Ebuild files."
+ :group 'company
+ :group 'ebuild)
+
+
+(defcustom company-ebuild-qsearch-executable (executable-find "qsearch")
+ "Path to the \"qsearch\" executable binary."
+ :safe 'stringp
+ :type 'file
+ :group 'company-ebuild)
+
+(defcustom company-ebuild--regenerate-dynamic-keywords-eclass t
+ "Whether to regenerate ‘company-ebuild--dynamic-keywords-eclass’."
+ :type 'boolean
+ :group 'company-ebuild)
+
+(defcustom company-ebuild--regenerate-dynamic-keywords-use-flags t
+ "Whether to regenerate ‘company-ebuild--dynamic-keywords-use-flags’."
+ :type 'boolean
+ :group 'company-ebuild)
+
+(defcustom company-ebuild--regenerate-dynamic-keywords-packages t
+ "Whether to regenerate ‘company-ebuild--dynamic-keywords-packages’."
+ :type 'boolean
+ :group 'company-ebuild)
+
+(defcustom company-ebuild--regenerate-dynamic-keywords-licenses t
+ "Whether to regenerate ‘company-ebuild--dynamic-keywords-licenses’."
+ :type 'boolean
+ :group 'company-ebuild)
+
+
+(provide 'company-ebuild-custom)
+
+
+
+;;; company-ebuild-custom.el ends here
diff --git a/company-ebuild.el b/company-ebuild.el
index d01160f..30f564a 100644
--- a/company-ebuild.el
+++ b/company-ebuild.el
@@ -44,6 +44,7 @@
(require 'company)
(require 'ebuild-mode)
+(require 'company-ebuild-custom)
(require 'company-ebuild-keywords)
@@ -94,25 +95,23 @@
"Return a list of all available packages.
Uses the \"qsearch\" tool to get the packages."
- (let ((qsearch
- (executable-find "qsearch"))
- (qsearch-formats
+ (let ((qsearch-formats
'("%{CATEGORY}/%{PN}"
"%{CATEGORY}/%{PN}-%{PV}"
"%{CATEGORY}/%{PN}-%{PV}:%{SLOT}"
"%{CATEGORY}/%{PN}-%{PV}:%{SLOT}::%{REPO}")))
(cond
- (qsearch
+ (company-ebuild-qsearch-executable
(mapcan (lambda (qsearch-format)
(let ((qlist-result
(shell-command-to-string
(format "%s --all --format \"%s\" --name-only --nocolor"
- qsearch
+ company-ebuild-qsearch-executable
qsearch-format))))
(split-string qlist-result "\n" t)))
qsearch-formats))
(t
- nil))))
+ '()))))
(defun company-ebuild--get-tags (file-path tag-name)
"Return all tags with TAG-NAME from file at FILE-PATH.
@@ -205,10 +204,14 @@ REPO-ROOT is the location from which we start searching for Eclass files."
(defun company-ebuild--regenerate-dynamic-keywords ()
"Regenerate dynamic keywords."
- (company-ebuild--regenerate-dynamic-keywords-eclass)
- (company-ebuild--regenerate-dynamic-keywords-use-flags)
- (company-ebuild--regenerate-dynamic-keywords-packages)
- (company-ebuild--regenerate-dynamic-keywords-licenses))
+ (when company-ebuild--regenerate-dynamic-keywords-eclass
+ (company-ebuild--regenerate-dynamic-keywords-eclass))
+ (when company-ebuild--regenerate-dynamic-keywords-use-flags
+ (company-ebuild--regenerate-dynamic-keywords-use-flags))
+ (when company-ebuild--regenerate-dynamic-keywords-use-flags
+ (company-ebuild--regenerate-dynamic-keywords-packages))
+ (when company-ebuild--regenerate-dynamic-keywords-licenses
+ (company-ebuild--regenerate-dynamic-keywords-licenses)))
(defun company-ebuild--grab-symbol ()
"Workaround wrapper for `company-grab-symbol'."