reddit / emacs

Custom company-backends: only "trigger" backend on specific keypress

codethrasher ยท 2022-07-31 22:24
Hey all! I have this custom backend I'm working on: (defun company-sample-backend (command &optional arg &rest ignored) (interactive (list 'interactive)) (let ((people (org-ql-select (concat org-dir "/contacts.org") '(level 1) :action #'org-get-heading))) (cl-case command (interactive (company-begin-backend 'company-sample-backend)) (prefix (and (eq major-mode 'org-mode) (company-grab-symbol))) (candidates (my/contacts-candidates arg)) (post-completion (company-thing arg))))) It works well, so far. However, what I'd like is to have this backend "kick in" _only_ when I press `@`. I'm not entirely sure how to achieve this. I assume it needs to be done in the `prefix` logic, but my attempts don't seem to work. I'm hoping someone has done this and can show me the (probably simple) solution. Thanks!