1

I've been using Neil Van Dyke's scribble-mode for editing Scribble code in Emacs. I'm also using auto-complete and ac-capf to get better completion in scribble-mode. However, I've been running into a problem wherein I can't get auto-completion directly after an @ character in scribble-mode buffers. This is a problem because the @ character is an important part of Scribble's syntax. My current workaround is to type a keyword out and use a keybinding to auto-insert an @ before the word. However, this is becoming quite tedious and I would like to have normal-style completion instead. A very weird part about this is that pressing M-TAB (which runs the completion-at-point function) displays completion candidates in the *Completions* buffer, even after an @ character, so I'm not sure why this isn't working with auto-complete / ac-capf. Here's a screencast demonstrating my problem.

So, my question is how can I get auto-completion to work directly after an @ character in scribble-mode?

1 Answer 1

0

I came up with a hacky solution / workaround to this problem. Instead of using ac-capf for completion, I used ac-company to access the company-capf backend of company-mode. I put the following code in my init files to do this:

;; Feed company backends to auto-complete
(autoload 'ac-company-define-source "ac-company" nil nil 'macro)
(autoload 'ac-company-prefix "ac-company")
...
(ac-company-define-source ac-source-company-scribble company-capf)
(add-hook 'scribble-mode-hook '(lambda ()
                                 (add-to-list 'ac-sources 'ac-source-company-scribble)
                                 (auto-complete-mode t)))

The reasons that this is hacky are that 1) it doesn't address the issue with ac-capf 2) this solution borks the auto-complete menu faces and 3) this solution causes an annoying error to appear in the minibuffer on completion and when cycling through completion candidates: Error running timer ‘ac-quick-help’: (wrong-type-argument stringp nil). Nonetheless, the error and messed up faces seem to be of no consequence and this solution appears to work fine. Here's a screencast showing it in action.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.