Disclaimer: I'm the author of irony-mode
If you just want smart auto-completion, I can recommend irony-mode with company-irony.
irony-mode is easy to install thanks to MELPA
the completion is very accurate and the performance quite decent thanks to libclang
with company-irony you have an asynchronous completion backend that will not get in your way if the ...
Different levels of "IDE-ness" exist for different languages, and unfortunately you're never going to get full IDE features without some configuration (if you don't like configuring things, you probably shouldn't use Emacs). CEDET aims to be a complete solution that covers all your needs for supported languages, but I've personally never gotten it working ...
Check my guide. It lists several methods for auto-completion in C/C++.
Those options are:
Using Irony. Highly recommended, since it uses Clang and easy to setup compared with other solutions.
Using the built-in parser from Emacs. It is the best auto-complete you can get is from within Emacs parser, Semantic, but it would be slow on large project like ...
I used this guide to get started using Emacs as a C++ IDE. It introduces Helm and Projectile which help answer a number of your questions. To wit,
Projectile manages projects. It searches up the directory tree for a Makefile, SConstruct, Git repo, SVN repo, and perhaps some other build system or version control files to automatically learn what files are ...
If you are writing C/C++/Java/Emacs Lisp/Python, then semantic-sticky-func-mode will do what you want.
NOTE: This seems to be working with CEDET from Git, not stock CEDET currently in Emacs 24.4. To get Emacs from Git:
git clone http://git.code.sf.net/p/cedet/git cedet
And load CEDET first above everything else in your init file:
(load-file (concat ...
I've had great success with RTags + Company.
RTags needs a separate daemon rdm running that uses clang for code-completion, code-navigation and refactoring. rdm also functions as a database of symbols, meaning that autocompletion is much faster than any solution just directly calling clang_codeCompleteAt.
Rdm needs info of compilation flags for your ...
Since you are asking for a full-featureed C/C++ IDE now, I might be qualified.
I used all MS IDEs from vc4 to Visual Studio 2010, so I fully understand what you want.
The good news is that Emacs could be 95% as good as Visual Studio, and it can do much more. but you might be not interested in the "more" part. So I will focus on your questions only.
The Emacs one is actually better. Here's why, The purpose of syntax highlighting in text editors is not being pretty, but to make important code structures stand out.
If you look at the Emacs sample, you'll see 'MyClass' being colored in the 'type name' color and 'obj' in 'variable' color, which makes the important information that you have one variable '...
That's a lot of questions, but I will try to answer them in such a way that you can look up all the answers in detail.
Emacs is primarily a text editor; you will use it to edit your C++ files. Converting those files into a program that your computer can run is the job of a compiler. There are many C++ compilers, but you will want to use one called gcc. ...
EDIT: As of late December 2018, this is no longer required, and lsp-mode does the required setup automatically. It was fixed in this commit as far as I can tell.
You need to call lsp-clients-register-clangd, as per https://github.com/emacs-lsp/lsp-clangd/issues/11. To do this, you can either call it interactively using M-x lsp-clients-register-clangd to ...
One option is to add "auto" to extra types recognized by c++-mode:
(add-to-list 'c++-font-lock-extra-types "auto")
The downside is that now it is not highlighted as a keyword any more. (But "auto" is both a type and a keyword, in a way.)
You can turn on which-function-mode by doing
M-x which-function-mode RET
To make the setting permanent, add
to your init-file.
From the documentation:
Toggle mode line display of current function (Which Function mode). [...]
Which Function mode is a global minor mode. When enabled, the
current function name is ...
company-mode + clang
The only issue is you need tell company-mode where to search your project's c/c++ header files.
If you use cmake, you can let https://github.com/redguardtoo/cpputils-cmake to do the setup for you (HINT: I'm the author of cpputils-cmake).
company-mode + gnu global
Nothing more to say, you need build the ...
irony-mode's author here.
So, For tiny projects that I might be working on, which are compiled
with a simple g++ foo.c -o foo, how should I put the compile files to
make irony-mode work?
If you don't have any flags you don't have to do anything. You give irony-mode some flags only so that it can parse your file. In your case, no flags are needed to ...
I'm writing a guide for Ebrowse and will release it in this week.Ebrowse is a fast parser used to process C++ source files to produce a database that contains the class hierarchy that is later processed by Emacs to produce a class tree representation. It is somewhat like GNU Global, but is built-into Emacs and produce a class tree, so it will take longer to ...
OP here, my clang executable wasn't being recognized by company-clang because the name of the executable in my /usr/bin was clang-3.5 and not clang.
Using M-x customize-variable RET company-clang-executable RET as @elethan suggested and setting the absolute path to the clang executable didn't resolve the problem.
Above suggested that company-clang was ...
It's not weird; std: could be a label and until you type the second : it doesn't know otherwise.
Edit: I forgot to mention, but you can customize c-default-style to choose a different indentation style, and you can add your own entries to c-style-alist to make one that's exactly to your liking.
This can be done pretty easily.
press M-x RET customize-face RET font-lock-function-name-face RET and you'll get the customization menu for function name face. You can change any attribute you want(font weight, height, color, etc.) and don't forget to click on Apply and Save and save for future sessions.
UPDATE: That pretest version that I put down there in the original question (emacs-26.0.90.tar.gz) had a bug that cause certain infinity loops while parsing the buffer, specifically when using the < token in certaing contexts, like writting < as the first character of an empty buffer in Java or C++ or after the keyword template. The bug has been fixed ...
For #4, I highly recommend exuberant-ctags and the built-in tags support, which I have used for years. Alternatively, I just recently have switched to using GNU Global and the ggtags package and have found them to be slightly superior; although, they function almost identically. Both work with nearly no configuration. For other IDE features, I also like the ...
this seems to answer the member function bit of your question
"\\<[_a-zA-Z][_a-zA-Z0-9]*\\>" ; Object identifier
"\\s *" ; Optional white space
"\\(?:\\.\\|->\\)" ; Member access
"\\s *" ; Optional white space
With irony-mode, you can use M-x irony-get-type RET. This probably won't work for everything but it worked for the following snippet:
auto var = 1.0;
Having the cursor on any of the two var, and calling M-x irony-get-type RET, returns: double in the minibuffer.
Management of software "projects." I want my IDE to have a sense of
all of the files that make up my current project so that I can perform
functions like search-and-replace within my project. (It would be nice
if I could also achieve this without littering my source tree with
lots of support files. Why do I need more than one centralized project
I use the following which is a mashup of the standard doxymacs based one and abo-abo's semantic based one mentioned as an answer already - this only requires semantic and yasnippet. This pre-populates some more of the yasnippet placeholders with relevant info as well compared to abo-abo 's version too.
# -*- mode: snippet -*-
# name: dox
# key: dox
# type: ...
Here is a start. Add to your .emacs file:
(global-set-key [f4] 'compile)
You can also enter the "f4" and "compile" interactively. Starting out with
Compile is a generic for running any command in a separate buffer. The default command runs "make", which may or not be what you want. You have an opportunity to change that and compile ...
C-h f compile tells you:
Compile the program including the current buffer. Default: run make.
Runs COMMAND, a shell command, in a separate process asynchronously
with output going to the buffer *compilation*.
You can then use the command C-x ` to find the next error message
and move to the source code that caused it.
I can only tell for rtags that I have been using actively for the last 1-2 years.
rtags works as expected. It is compiler based and provides correct code navigation. Something I have been looking for for the past 10 years as an emacs user.
Setup can be a bit tricky. I recommend taking a look at cmake-ide, that does part of the setup automatically.
You need to do two things: 1. Bind compile to a key (like f5) 2. Change the command that compile runs.
To do the first add (define-key c++-mode-map [f5] #'compile) to your .emacs. This sets the key only in c++-mode; you can make it a global binding if you want by using global-map instead.
For the second, the compile function just runs whatever is stored ...
You can add a function for that to arglist-cont-nonempty. In the following example my-c-lineup-arglist-lambda should do what you want:
'((indent-tabs-mode . nil)
(c-basic-offset . 4)
(substatement-open . 0) ...