From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 7CC13158094 for ; Sat, 20 Aug 2022 13:06:41 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 46D95E0837; Sat, 20 Aug 2022 13:06:39 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 22420E0837 for ; Sat, 20 Aug 2022 13:06:39 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 1BD86340DB5 for ; Sat, 20 Aug 2022 13:06:38 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 3ED1657B for ; Sat, 20 Aug 2022 13:06:36 +0000 (UTC) From: "Maciej Barć" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Maciej Barć" Message-ID: <1661000716.39424f5d9ff5a79b69e0bf0b5ed2b94e51a90340.xgqt@gentoo> Subject: [gentoo-commits] proj/company-ebuild:master commit in: / X-VCS-Repository: proj/company-ebuild X-VCS-Files: Cask Makefile company-ebuild-custom.el company-ebuild.el X-VCS-Directories: / X-VCS-Committer: xgqt X-VCS-Committer-Name: Maciej Barć X-VCS-Revision: 39424f5d9ff5a79b69e0bf0b5ed2b94e51a90340 X-VCS-Branch: master Date: Sat, 20 Aug 2022 13:06:36 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 9d487781-8a8a-41c2-b711-6c9df0c9938f X-Archives-Hash: 9bd171c58ab7636dd0538a627d85348f commit: 39424f5d9ff5a79b69e0bf0b5ed2b94e51a90340 Author: Maciej Barć gentoo org> AuthorDate: Sat Aug 20 13:05:16 2022 +0000 Commit: Maciej Barć gentoo 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ć 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 . + + + +;;; 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'."