Пытаюсь настроить company-mode в emacs. Когда складываю исходники в корень проекта, то все автодополняет без нареканий. Но вот когда исходники расположены во вложенных папках ниченго не работает.
Структура проекта такая:
(ede-cpp-root-project "Firmware"
:name "Firmware Project"
:file "C:/DHARMS 3/lb2/firmware/Makefile"
:include-path '("/"
"/CMSIS/Include/"
"/CMSIS/Device/ST/STM32F7xx/Source/Templates/gcc/"
"/CMSIS/Device/ST/STM32F7xx/Source/Templates/"
"/CMSIS/Device/ST/STM32F7xx/Include/"
)
;;:system-include-path '("C:/DHARMS 3/lb2/firmware/")
:spp-table '(("STM32F722xx" . ""))
)
Добавил код из company-c-headers
(defun ede-object-system-include-path ()
"Return the system include path for the current buffer."
(when ede-object
(ede-system-include-path ede-object)))
(setq company-c-headers-path-system 'ede-object-system-include-path)
Весь конфиг:
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
;; Comment/uncomment this line to enable MELPA Stable if desired. See `package-archive-priorities`
;; and `package-pinned-packages`. Most users will not need or want to do this.
;;(add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t)
(add-to-list 'package-archives '("elpa" . "http://elpa.gnu.org/packages/") t)
(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/") t)
(package-initialize)
(require 'use-package)
;; CEDET config
;; select which submodes we want to activate
;;(add-to-list 'semantic-default-submodes 'global-semantic-mru-bookmark-mode)
(add-to-list 'semantic-default-submodes 'global-semanticdb-minor-mode)
(add-to-list 'semantic-default-submodes 'global-semantic-idle-scheduler-mode)
(add-to-list 'semantic-default-submodes 'global-semantic-stickyfunc-mode)
(add-to-list 'semantic-default-submodes 'global-cedet-m3-minor-mode)
(add-to-list 'semantic-default-submodes 'global-semantic-highlight-func-mode)
(defun my-cedet-hook ()
(local-set-key [(control return)] 'semantic-ia-complete-symbol)
(local-set-key "\C-c?" 'semantic-ia-complete-symbol-menu)
(local-set-key "\C-c>" 'semantic-complete-analyze-inline)
(local-set-key "\C-cp" 'semantic-analyze-proto-impl-toggle)
(local-set-key "\C-cj" 'semantic-complete-jump-local)
(local-set-key "\C-cJ" 'semantic-complete-jump))
(add-hook 'c-mode-common-hook 'my-cedet-hook)
;; ECB config
(require 'ecb)
;;; set layout for ECB
(setq ecb-layout-name "left15")
;;; show source files in directories buffer
(setq ecb-show-sources-in-directories-buffer 'always)
;;; keep a persistent compile window in ECB
(setq ecb-compile-window-height 12)
;;; activate and deactivate ecb
(global-set-key (kbd "C-x C-;") 'ecb-activate)
(global-set-key (kbd "C-x C-'") 'ecb-deactivate)
;;; show/hide ecb window
(global-set-key (kbd "C-;") 'ecb-show-ecb-windows)
(global-set-key (kbd "C-'") 'ecb-hide-ecb-windows)
;;; quick navigation between ecb windows
(global-set-key (kbd "C-)") 'ecb-goto-window-edit1)
(global-set-key (kbd "C-!") 'ecb-goto-window-directories)
(global-set-key (kbd "C-@") 'ecb-goto-window-sources)
(global-set-key (kbd "C-#") 'ecb-goto-window-methods)
(global-set-key (kbd "C-$") 'ecb-goto-window-compilation)
(setq ecb-tip-of-the-day nil)
;;(setq ecb-source-path '("C:/DHARMS 3/lb2/firmware"))
(setq ecb-auto-activate 1)
(custom-set-variables
'(compile-command "mingw32-make -k")
)
;; EDE
(global-ede-mode t)
(ede-enable-generic-projects)
(ede-cpp-root-project "Firmware"
:name "Firmware Project"
:file "C:/DHARMS 3/lb2/firmware/Makefile"
:include-path '("/"
"/CMSIS/Include/"
"/CMSIS/Device/ST/STM32F7xx/Source/Templates/gcc/"
"/CMSIS/Device/ST/STM32F7xx/Source/Templates/"
"/CMSIS/Device/ST/STM32F7xx/Include/"
)
;;:system-include-path '("C:/DHARMS 3/lb2/firmware/")
:spp-table '(("STM32F722xx" . ""))
)
(require 'company)
(use-package company
:ensure t
:config
(setq company-iddle-delay 0)
(setq company-minimum-prefix-length 3)
(global-company-mode t)
)
(define-key company-active-map (kbd "<wheel-up>") #'company-select-next)
(define-key company-active-map (kbd "<wheel-down>") #'company-select-previous)
(require 'company-c-headers)
(add-to-list 'company-backend 'company-c-headers)
;;(add-to-list 'company-c-headers-path-system "C:/DHARMS 3/lb2/firmware")
(require 'company-irony)
(use-package company-irony
:ensure t
:config
(add-to-list 'company-backends 'company-irony)
)
(require 'irony)
(use-package irony
:ensure t
:config
(add-hook 'c++-mode-hook 'irony-mode)
(add-hook 'c-mode-hook 'irony-mode)
(add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)
)
(require 'irony-eldoc)
(use-package irony-eldoc
:ensure t
:config
(add-hook 'irony-mode-hook #'irony-eldoc)
)
(defun my/python-mode-hook ()
(add-to-list 'company-backends 'company-jedi)
)
(add-hook 'python-mode-hook 'my/python-mode-hook)
(use-package company-jedi
:ensure t
:config
(add-hook 'python-mode-hook 'jedi:setup)
)
(defun my/python-mode-hook ()
(add-to-list 'company-backends 'company-jedi)
)
(add-hook 'python-mode-hook 'my/python-mode-hook)
;; Windows performance tweaks
;;
(when (boundp 'w32-pipe-read-delay)
(setq w32-pipe-read-delay 0))
;; Set the buffer size to 64K on Windows (from the original 4K)
(when (boundp 'w32-pipe-buffer-size)
(setq irony-server-w32-pipe-buffer-size (* 64 1024)))
;;
;; Setup company-irony
;;
(add-hook 'c-mode-common-hook 'company-mode)
(eval-after-load 'company
'(add-to-list
'company-backends '(company-irony-c-headers company-irony)))
(defun ede-object-system-include-path ()
"Return the system include path for the current buffer."
(when ede-object
(ede-system-include-path ede-object)))
(setq company-c-headers-path-system 'ede-object-system-include-path)
Не пинайте сильно - лисп только в планах, а среда нужна уже сейчас. Держать регистры в памяти сложновато. Поэтому хочется автодополнение.