public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Maciej Barć" <xgqt@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/company-ebuild:master commit in: /
Date: Sat, 20 Aug 2022 13:06:36 +0000 (UTC)	[thread overview]
Message-ID: <1661000716.39424f5d9ff5a79b69e0bf0b5ed2b94e51a90340.xgqt@gentoo> (raw)

commit:     39424f5d9ff5a79b69e0bf0b5ed2b94e51a90340
Author:     Maciej Barć <xgqt <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 20 13:05:16 2022 +0000
Commit:     Maciej Barć <xgqt <AT> gentoo <DOT> org>
CommitDate: Sat Aug 20 13:05:16 2022 +0000
URL:        https://gitweb.gentoo.org/proj/company-ebuild.git/commit/?id=39424f5d

company-ebuild-custom.el: add; enable customization of some features from company-ebuild.el

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

 Cask                     |  3 ++-
 Makefile                 |  2 +-
 company-ebuild-custom.el | 70 ++++++++++++++++++++++++++++++++++++++++++++++++
 company-ebuild.el        | 23 +++++++++-------
 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'."


             reply	other threads:[~2022-08-20 13:06 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-20 13:06 Maciej Barć [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-06-18 20:22 [gentoo-commits] proj/company-ebuild:master commit in: / Maciej Barć
2023-06-18 20:19 Maciej Barć
2023-06-18 20:15 Maciej Barć
2023-04-25 19:48 Maciej Barć
2023-04-25 19:38 Maciej Barć
2023-03-11  8:17 Maciej Barć
2023-02-03 13:50 Maciej Barć
2023-01-29 20:26 Maciej Barć
2022-12-13 10:44 Maciej Barć
2022-12-02  0:40 Maciej Barć
2022-12-02  0:38 Maciej Barć
2022-08-30 22:22 Maciej Barć
2022-08-30 18:22 Maciej Barć
2022-08-30 18:22 Maciej Barć
2022-08-30 18:22 Maciej Barć
2022-08-25 23:17 Maciej Barć
2022-08-25 23:00 Maciej Barć
2022-08-25 23:00 Maciej Barć
2022-08-17 15:23 Maciej Barć
2022-08-17 15:21 Maciej Barć
2022-08-17 15:19 Maciej Barć
2022-08-17 15:19 Maciej Barć
2022-08-17 15:19 Maciej Barć
2022-08-17  1:54 Maciej Barć
2022-08-17  1:54 Maciej Barć
2022-08-17  0:37 Maciej Barć
2022-08-17  0:31 Maciej Barć
2022-08-16 23:50 Maciej Barć
2022-08-16 23:50 Maciej Barć
2022-08-16 23:50 Maciej Barć
2022-08-16 23:50 Maciej Barć
2022-08-16 23:50 Maciej Barć
2022-08-16 23:50 Maciej Barć
2022-08-16 20:31 Maciej Barć
2022-08-16 20:28 Maciej Barć
2022-08-16 20:28 Maciej Barć

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1661000716.39424f5d9ff5a79b69e0bf0b5ed2b94e51a90340.xgqt@gentoo \
    --to=xgqt@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox