lang/cc: make ffap aware of irony include paths
This commit is contained in:
parent
31a0ad5b95
commit
957aa9c63e
1 changed files with 15 additions and 1 deletions
|
@ -145,9 +145,23 @@ compilation dbs."
|
||||||
(unless (irony-cdb-autosetup-compile-options)
|
(unless (irony-cdb-autosetup-compile-options)
|
||||||
(irony-cdb--update-compile-options
|
(irony-cdb--update-compile-options
|
||||||
(append (delq nil (cdr-safe (assq major-mode +cc-default-compiler-options)))
|
(append (delq nil (cdr-safe (assq major-mode +cc-default-compiler-options)))
|
||||||
|
(list (locate-dominating-file (or buffer-file-name default-directory)
|
||||||
|
"include"))
|
||||||
(cl-loop for path in +cc-default-include-paths
|
(cl-loop for path in +cc-default-include-paths
|
||||||
nconc (list "-I" path)))
|
nconc (list "-I" path)))
|
||||||
(doom-project-root)))))
|
(doom-project-root)))
|
||||||
|
;; Make ffap aware of include paths
|
||||||
|
(when irony--working-directory
|
||||||
|
(require 'ffap)
|
||||||
|
(make-local-variable 'ffap-c-path)
|
||||||
|
(make-local-variable 'ffap-c++-path)
|
||||||
|
(cl-loop for opt in irony--compile-options
|
||||||
|
if (string-match "^-I\\(.+\\)" opt)
|
||||||
|
do (add-to-list (pcase major-mode
|
||||||
|
(`c-mode 'ffap-c-path)
|
||||||
|
(`c++-mode 'ffap-c++-path))
|
||||||
|
(expand-file-name (match-string 1 opt)
|
||||||
|
irony--working-directory))))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +cc|cleanup-rtags ()
|
(defun +cc|cleanup-rtags ()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue