Comments (3)
I could, if you explain CEDET to me...
from emacs-clang-complete-async.
I managed to get ac-clang-complete-(async) to play at least with the ede-cpp-root-project stuff from CEDET. While i still use CEDET/semantic for browsing in my code i disabled it's completion features because ac-clang-complete works much better (not only faster but also accurate :-)).
Here's my configuration snippet. Note that i'm not a real good elisp-hacker so if you have hints to improve then let me know...
(when (file-directory-p "~/lisp/emacs-clang-complete-async")
(add-to-list 'load-path "~/lisp/emacs-clang-complete-async")
(require 'auto-complete-clang-async)
(require 'ede)
(when (file-exists-p "~/.emacs.d/clang-complete")
(setq ac-clang-complete-executable "~/.emacs.d/clang-complete"))
(when (and (string= ac-clang-complete-executable "")
(file-exists-p "~/bin/clang-complete"))
(setq ac-clang-complete-executable "~/bin/clang-complete" "/"))
(when (file-directory-p "~/bin/llvm-3.3-svn/lib")
(setenv "LD_LIBRARY_PATH" (expand-file-name "~/bin/llvm-3.3-svn/lib" "/")))
(cond ((string-equal system-name "darkstar")
(setq ac-cc-mode-system-includes '("/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../include/c++/4.8.1"
"/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../include/c++/4.8.1/x86_64-unknown-linux-gnu"
"/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../include/c++/4.8.1/backward"
"/usr/local/include"
"/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/include"
"/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/include-fixed"
"/usr/include")))
((string-equal system-name "hostname-at-work")
(setq ac-cc-mode-system-includes '("/usr/include/c++/4.4"
"/usr/include/c++/4.4/x86_64-linux-gnu"
"/usr/include/c++/4.4/backward"
"/usr/local/include"
"/usr/lib/gcc/x86_64-linux-gnu/4.4.5/include"
"/usr/lib/gcc/x86_64-linux-gnu/4.4.5/include-fixed"
"/usr/include")))
(t nil))
(defmethod ede-include-path ((this ede-cpp-root-project))
"Get the system include path used by ede-project."
(oref this include-path))
(defvar ac-cc-mode-setup-cflags-hook nil
"This hooks are run after the ede and system-includes are set")
(defun ac-cc-mode-setup-from-ede-project ()
"Setup ac-clang-completion based on ede-cpp-root-project"
(ac-config-default)
(when (ede-current-project)
(let ((prj (ede-current-project))
(root (ede-project-root-directory (ede-current-project)))
(cxxflags))
;;---------------------------------------------------------------------------------------------------------------
;; first: parse the ede :spp-table.
;; second: parse the ede :include dirs
;; third: parse the ede :system-include dirs
;; finally: add the ac-cc-mode-system-includes
;;---------------------------------------------------------------------------------------------------------------
(setq cxxflags (append
(mapcar (lambda (def) (let ((sym (car def))
(val (cdr def)))
(cond ((and (stringp val)
(not (zerop (length val))))
(format "-D%s=\"%s\"" sym val))
((numberp val)
(format "-D%s=%s" sym (number-to-string val)))
(t
(concat "-D" sym)))))
(ede-preprocessor-map prj))
(mapcar (lambda (dir) (format "-I%s%s" root (substring dir 1 nil)))
(ede-include-path prj))
(mapcar (lambda (dir) (format "-I%s" dir))
(ede-system-include-path prj))
(mapcar (lambda (dir) (format "-I%s" dir)) ac-cc-mode-system-includes)))
(setq ac-clang-cflags cxxflags))
(setq ac-sources '(ac-source-clang-async))
(run-hooks 'ac-cc-mode-setup-hook)
(ac-clang-launch-completion-process)
(local-set-key (kbd "C-<tab>") 'ac-complete-clang-async)))
(add-hook 'c-mode-common-hook 'ac-cc-mode-setup-from-ede-project)
(add-hook 'auto-complete-mode-hook 'ac-common-setup)
)
Sample project.el:
(ede-cpp-root-project "your-proj"
:name "your-proj"
:file "~/projects/your-proj/Makefile"
:include-path '("/build"
"/first/include"
"/second/include")
:system-include-path '("/usr/include/boost")
:spp-table '(("DEBUG" . "")
("SYMBOL" . "")
("ZERO" . 0)
("ONE" . 1)
("PROJECT_NAME" . "your-proj")
("PROJECT_VERSION" . "1.0.0")))
(defun project-add-clang-cflags ()
(setq ac-clang-cflags (append '("-std=c++11" "-Wall" "-Wextra" "-pedantic" "-D_REENTRANT") ac-clang-cflags)))
(add-hook 'ac-cc-mode-setup-cflags-hook 'project-add-clang-cflags)
from emacs-clang-complete-async.
The ac-clang-cflags setup you have here is unique from what I have. Can you ac-complete the library ?
from emacs-clang-complete-async.
Related Issues (20)
- Normal auto completion features doesn't work properly with auto-complete-clang
- Auto-completion is not working HOT 3
- llvm 3.4 compatibility HOT 2
- Query multiple interfaces of a function and provide selection
- Mac OS X w/ Xcode 5.1.1: error: unknown type name 'FILE' HOT 2
- 补全Qt库总会出现这种形式"func:func()"
- C++11 support HOT 2
- Why (setq ac-sources '(ac-source-clang-async)) ? HOT 1
- Failed to compile on ArchLinux HOT 3
- make error on os x HOT 1
- The current version not work for Qt completions HOT 1
- Fail to complete when using template parameters in the definitions of template classes or functions HOT 1
- appending to ac-clang-cflags by project specific .dir-locals.el HOT 5
- auto complete clang async conflicts with builtin sources HOT 2
- make error on archlinux HOT 1
- What is the license?
- Failed to compile on Ubuntu14.10 HOT 1
- How to install emacs-clang-complete-async using elpa?
- Cannot complete container and smart pointer with '-std=c++11' flag
- Cannot open load file, no such file or directory, auto-complete-clang-async HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from emacs-clang-complete-async.