My computer system and set up are
OS: Arch Linux 64bit
emacs version: 24.4
alias emacs='emacsclient -t -s server --alternate-editor='
Update:
auto complete
is working with yasnippet
occasionally now but not as expected. I changed the line
(add-to-list 'achead:include-directories
'"/usr/include/c++/4.9.2/")
If I type #include <io
and hit tab, I get back #include <#include <iostream>
. Therefore, I then tried just typing <io
and tab which produces <#include <iostream>
. If I type ios
and hit type, the desired result is achieved. I then tested this with float.h
. No iteration works.
I then tried re-testing io
and tab. This doesn't work 100% of the time. 50% of the time I get #include <iostream>
and the other 50% nothing happens. Needless to say, I have no idea what is going on with this package or feature.
I am trying to get auto complete to work with C/C++ headers; however, I have been unable to do so. I executed the following command in the terminal to locate the C/C++ headers:
[dustin@dustin ~]$ g++ -print-prog-name=cc1plus -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/lto-wrapper
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/cc1plus
but using /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/cc1plus
does not produce the desired outcome. I have also ran a search looking for float.h
just to determine locations as well and came up with
[dustin@dustin ~]$ sudo find / -name float.h
[sudo] password for dustin:
/usr/include/c++/4.9.2/tr1/float.h
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/include/float.h
So I also tried /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/include
. I am not to sure about /usr/include/c++/4.9.2/tr1
though.
Below is the relevant information in my .emacs
. All packages were downloaded and install from melpa
are up-to-date. If I run 'emacs' --debug-init
, there are no error messages. The ' '
around emacs is so that emacs will open without options for debugging only.
;; Start server and set directory
(setq server-socket-dir (format "/tmp/emacs1000"))
;; Package list M-x package-list-packages
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/"))
;; Package initialize
(package-initialize)
;; C/C++ configuration
(require 'cc-mode)
;; auto complete for C/C++
(require 'auto-complete)
;; default config for auto-complete
(require 'auto-complete-config)
(ac-config-default)
;; start yasnippets
(require 'yasnippet)
(yas-global-mode 1)
;; auto complete C++-headers
(defun my:ac-c-header-init ()
(require 'auto-complete-c-headers)
(add-to-list 'ac-sources 'ac-source-c-header)
(add-to-list 'achead:include-directories
'"/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/include")
)
;; call ac-c-headers from c/c++ hooks
(add-hook 'c++-mode-hook 'my:ac-c-header-init)
(add-hook 'c-mode-hook 'my:ac-c-header-init)