summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej Barć <xgqt@gentoo.org>2022-08-17 02:31:00 +0200
committerMaciej Barć <xgqt@gentoo.org>2022-08-17 02:31:00 +0200
commit04dc62243b36c185e426df1eb80eadcbb482afb0 (patch)
tree54ab6eef3b36682afb01fcc72402560895287cf8
parentcompany-ebuild.el: bump to 0.1.0 (diff)
downloadcompany-ebuild-04dc62243b36c185e426df1eb80eadcbb482afb0.tar.gz
company-ebuild-04dc62243b36c185e426df1eb80eadcbb482afb0.tar.bz2
company-ebuild-04dc62243b36c185e426df1eb80eadcbb482afb0.zip
company-ebuild.el: change character syntax-table temporarily
Signed-off-by: Maciej Barć <xgqt@gentoo.org>
-rw-r--r--company-ebuild.el14
1 files changed, 9 insertions, 5 deletions
diff --git a/company-ebuild.el b/company-ebuild.el
index ef4096b..b50900a 100644
--- a/company-ebuild.el
+++ b/company-ebuild.el
@@ -218,6 +218,14 @@ FILE-PATH is the location from which we start searching for Eclass files."
(company-ebuild--regenerate-dynamic-keywords-packages)
(company-ebuild--regenerate-dynamic-keywords-licenses))
+(defun company-ebuild--grab-symbol ()
+ "Workaround wrapper for `company-grab-symbol'."
+ ;; TODO: (Hard mode) write a proper `company-grab-symbol' replacement.
+ (with-syntax-table (copy-syntax-table (syntax-table))
+ (modify-syntax-entry ?/ "w")
+ (modify-syntax-entry ?@ "w") ; To make Eclass tags work.
+ (company-grab-symbol)))
+
;;;###autoload
(defun company-ebuild (command &optional arg &rest ignored)
@@ -242,7 +250,7 @@ ARG is the completion argument for annotation and candidates."
(kind
(cdr (company-ebuild--annotation-and-kind arg)))
(prefix
- (and (eq major-mode 'ebuild-mode) (company-grab-symbol)))
+ (and (eq major-mode 'ebuild-mode) (company-ebuild--grab-symbol)))
(require-match
nil)))
@@ -255,10 +263,6 @@ in your config:
\(add-hook 'ebuild-mode-hook 'company-ebuild-setup)
or `require' Company-Ebuild:
\(require 'company-ebuild)"
- ;; HACK: Modify syntax to treat "/" as a word constituent.
- ;; TODO: (Hard mode) write a proper `company-grab-symbol' replacement.
- (modify-syntax-entry ?/ "w")
- (modify-syntax-entry ?@ "w") ; To make Eclass tags work.
;; Force-enable `company-mode'.
(when (null company-mode)
(company-mode +1))