diff options
Diffstat (limited to 'lisp/ravi-init-insertion.el')
| -rw-r--r-- | lisp/ravi-init-insertion.el | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lisp/ravi-init-insertion.el b/lisp/ravi-init-insertion.el index 2a29460..37a7849 100644 --- a/lisp/ravi-init-insertion.el +++ b/lisp/ravi-init-insertion.el @@ -110,19 +110,18 @@ (use-package company-c-headers :init - (progn - (add-to-list 'company-backends 'company-c-headers)) + (add-to-list 'company-backends 'company-c-headers) + :commands (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")) + (defun ravi/get-default-include-paths (compiler-executable) + (let* ((gcc-out (shell-command-to-string (concat compiler-executable " -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)))) + (mapc (lambda (dir) (add-to-list 'company-c-headers-path-system dir)) (ravi/get-default-include-paths "gcc"))) ;; To do: enable when moving to emacs 26+ ;; (use-package company-box :hook (company-mode-hook . company-box-mode) :ensure t) |
