From 070af4e075264d6c1f1e26d1a7a5a811d0d5dad8 Mon Sep 17 00:00:00 2001 From: Ravi R Kiran Date: Sun, 9 Nov 2014 21:54:24 -0800 Subject: More company-mode setup: c-headers and yasnippet diff --git a/ravi-init-insertion.el b/ravi-init-insertion.el index aea9cee..4bb9fc5 100644 --- a/ravi-init-insertion.el +++ b/ravi-init-insertion.el @@ -86,7 +86,33 @@ (if (company-manual-begin) (company-complete-common) (indent-according-to-mode))) - (bind-key "\t" 'ravi/complete-or-indent)) + (bind-key "\t" 'ravi/complete-or-indent) + + (use-package company-c-headers + :init + (progn + (add-to-list 'company-backends 'company-c-headers)) + :config + (progn + (defun ravi/get-default-include-paths () + (let* ((gcc-out (shell-command-to-string "g++ -E -x c++ - -v < /dev/null")) + (gcc-list-match (string-match "#include <...> search starts here:\n\\(.*\\(?:\n.*\\)*?\\)End of search list.\n" gcc-out)) + (combined-list (match-string 1 gcc-out)) + ;; Need the following rigamarole to handle paths with spaces in them + (path-list-with-spaces (and combined-list (split-string combined-list "\n" t))) + (path-list (and path-list-with-spaces (mapcar 's-trim-left path-list-with-spaces)))) + path-list)) + (mapc (lambda (dir) (add-to-list 'company-c-headers-path-system dir)) (ravi/get-default-include-paths)) + ) + :ensure t) + + ;; Get rid of company-semantic as it interferes with clang-based backends + (setq company-backends (delete 'company-semantic company-backends)) + ;; Get rid of company-clang since it is too noisy at this point + (setq company-backends (delete 'company-clang company-backends)) + + (require 'company-yasnippet) + (bind-key "" 'company-yasnippet)) :ensure t) -- cgit v0.10.1