2015-06-15 09:05:52 +02:00
|
|
|
;;; macros-company.el --- macros for company-mode
|
|
|
|
;; for ../core-company.el
|
|
|
|
|
|
|
|
;;;###autoload
|
2015-10-14 03:39:32 -04:00
|
|
|
(defmacro define-company-backend! (hook backends)
|
2015-06-15 09:05:52 +02:00
|
|
|
"Register a company backend for a mode."
|
|
|
|
(let ((def-name (intern (format "narf--init-company-%s" hook)))
|
|
|
|
(quoted (eq (car-safe backends) 'quote)))
|
|
|
|
`(progn
|
|
|
|
(defun ,def-name ()
|
|
|
|
(set (make-local-variable 'company-backends)
|
|
|
|
(append '((,@(mapcar (lambda (backend)
|
|
|
|
(if quoted
|
|
|
|
backend
|
|
|
|
(intern (format "company-%s" backend))))
|
|
|
|
(if quoted (cadr backends) backends))
|
|
|
|
company-semantic))
|
|
|
|
company-backends)))
|
|
|
|
(add-hook ',(intern (format "%s-hook" hook)) ',def-name))))
|
|
|
|
|
|
|
|
(provide 'macros-company)
|
|
|
|
;;; macros-company.el ends here
|