1 |
commit: 04dc62243b36c185e426df1eb80eadcbb482afb0 |
2 |
Author: Maciej Barć <xgqt <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Aug 17 00:31:00 2022 +0000 |
4 |
Commit: Maciej Barć <xgqt <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Aug 17 00:31:00 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/company-ebuild.git/commit/?id=04dc6224 |
7 |
|
8 |
company-ebuild.el: change character syntax-table temporarily |
9 |
|
10 |
Signed-off-by: Maciej Barć <xgqt <AT> gentoo.org> |
11 |
|
12 |
company-ebuild.el | 14 +++++++++----- |
13 |
1 file changed, 9 insertions(+), 5 deletions(-) |
14 |
|
15 |
diff --git a/company-ebuild.el b/company-ebuild.el |
16 |
index ef4096b..b50900a 100644 |
17 |
--- a/company-ebuild.el |
18 |
+++ b/company-ebuild.el |
19 |
@@ -218,6 +218,14 @@ FILE-PATH is the location from which we start searching for Eclass files." |
20 |
(company-ebuild--regenerate-dynamic-keywords-packages) |
21 |
(company-ebuild--regenerate-dynamic-keywords-licenses)) |
22 |
|
23 |
+(defun company-ebuild--grab-symbol () |
24 |
+ "Workaround wrapper for `company-grab-symbol'." |
25 |
+ ;; TODO: (Hard mode) write a proper `company-grab-symbol' replacement. |
26 |
+ (with-syntax-table (copy-syntax-table (syntax-table)) |
27 |
+ (modify-syntax-entry ?/ "w") |
28 |
+ (modify-syntax-entry ?@ "w") ; To make Eclass tags work. |
29 |
+ (company-grab-symbol))) |
30 |
+ |
31 |
|
32 |
;;;###autoload |
33 |
(defun company-ebuild (command &optional arg &rest ignored) |
34 |
@@ -242,7 +250,7 @@ ARG is the completion argument for annotation and candidates." |
35 |
(kind |
36 |
(cdr (company-ebuild--annotation-and-kind arg))) |
37 |
(prefix |
38 |
- (and (eq major-mode 'ebuild-mode) (company-grab-symbol))) |
39 |
+ (and (eq major-mode 'ebuild-mode) (company-ebuild--grab-symbol))) |
40 |
(require-match |
41 |
nil))) |
42 |
|
43 |
@@ -255,10 +263,6 @@ in your config: |
44 |
\(add-hook 'ebuild-mode-hook 'company-ebuild-setup) |
45 |
or `require' Company-Ebuild: |
46 |
\(require 'company-ebuild)" |
47 |
- ;; HACK: Modify syntax to treat "/" as a word constituent. |
48 |
- ;; TODO: (Hard mode) write a proper `company-grab-symbol' replacement. |
49 |
- (modify-syntax-entry ?/ "w") |
50 |
- (modify-syntax-entry ?@ "w") ; To make Eclass tags work. |
51 |
;; Force-enable `company-mode'. |
52 |
(when (null company-mode) |
53 |
(company-mode +1)) |