From 2329c3a7fc7ab4beb8caaeaedfa2b17ea4cf1db2 Mon Sep 17 00:00:00 2001 From: mousebot Date: Thu, 21 Oct 2021 16:40:31 +0200 Subject: revert to forward-whitespace -1 test for company - this is an attempt to only engage company completion when our "word" at point is prefixed with a "@" - for some reason i dont understand, using company-grab-symbol-cons "^@ ..." doesn't work here: typing words with no @ still triggers company --- lisp/mastodon-toot.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index 6e41fc1..3a8ae92 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -426,9 +426,13 @@ The prefix string is tested against both user handles and display names." (interactive (list 'interactive)) (cl-case command (interactive (company-begin-backend 'mastodon-toot--mentions-completion)) - (prefix (and (bound-and-true-p mastodon-toot-mode) ; if masto toot minor mode - ;; @ + thing before point - (concat "@" (company-grab-symbol-cons "^@[0-9A-Za-z-.\\_@]+" 2)))) + (prefix (when (and (bound-and-true-p mastodon-toot-mode) ; if masto toot minor mode + (save-excursion + (forward-whitespace -1) + (forward-whitespace 1) + (looking-at "@"))) + ;; @ + thing before point + (concat "@" (company-grab-symbol)))) (candidates (mastodon-toot--mentions-company-candidates arg)) (annotation (mastodon-toot--mentions-company-annotation arg)))) -- cgit v1.2.3