diff options
author | mousebot <mousebot@riseup.net> | 2021-10-21 16:40:31 +0200 |
---|---|---|
committer | mousebot <mousebot@riseup.net> | 2021-10-21 16:40:31 +0200 |
commit | 2329c3a7fc7ab4beb8caaeaedfa2b17ea4cf1db2 (patch) | |
tree | d87f578c120c83a294fa30fb451b223804232ba3 /lisp | |
parent | 8d36399e239826b5a8cc34ce15306f9f51759a7f (diff) |
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
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/mastodon-toot.el | 10 |
1 files 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)))) |