Hot answers tagged

48 votes
Accepted

How to get intelligent auto-completion in C++?

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 ...
28 votes

Using Emacs as a full-featured C/C++ IDE

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 ...
  • 4,998
23 votes

How to get intelligent auto-completion in C++?

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 ...
  • 6,692
16 votes

Using Emacs as a full-featured C/C++ IDE

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 ...
15 votes
Accepted

Display the beginning of a scope when it is out of screen

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 ...
  • 6,692
11 votes

Better syntax-higlighting for member variables and function calls in cpp-mode

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, ...
10 votes

Using Emacs as a full-featured C/C++ IDE

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 ...
  • 4,661
10 votes
Accepted

How to compile and run a C++ file?

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. ...
  • 12.6k
9 votes

How to get intelligent auto-completion in C++?

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 ...
9 votes
Accepted

formatting constexpr if in c++-mode

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 <...
8 votes
Accepted

How do I get company mode to recognize clang?

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-...
  • 111
8 votes
Accepted

lsp-mode: How to use built-in clangd client?

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-...
  • 144
7 votes

How to get intelligent auto-completion in C++?

Solution 1: 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-...
  • 4,661
7 votes
Accepted

Enlarge font size of function names in source code like Source Insight

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(...
6 votes
Accepted

Change the way CC-mode font-lock the C++11 `auto` syntax

One option is to add "auto" to extra types recognized by c++-mode: (require 'cc-mode) (add-to-list 'c++-font-lock-extra-types "auto") The downside is that now it is not highlighted as a keyword any ...
  • 9,002
6 votes

Display the beginning of a scope when it is out of screen

You can turn on which-function-mode by doing M-x which-function-mode RET To make the setting permanent, add (which-function-mode 1) to your init-file. From the documentation: Toggle mode line ...
  • 14.3k
6 votes
Accepted

How should I configure irony-mode if my project has no "compilation flags"?

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 ...
6 votes
Accepted

Class Browsing in C++

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 ...
  • 6,692
6 votes

Better syntax-higlighting for member variables and function calls in cpp-mode

this seems to answer the member function bit of your question (font-lock-add-keywords 'c++-mode `((,(concat "\\<[_a-zA-Z][_a-zA-Z0-9]*\\>" ; Object identifier "\\s *" ...
6 votes
Accepted

Weird indentation behavior in C++ mode

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 ...
  • 12.6k
6 votes
Accepted

Extra indentation for argument lists beginning on a new line

Set point on the line in question and press C-c C-s to call c-show-syntactic-information. This shows you which variable you need to set. I set this to: (c-offsets-alist . ( (arglist-intro . c-...
  • 4,286
5 votes

Using Emacs as a full-featured C/C++ IDE

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 ...
  • 1,955
5 votes

How to get semantic syntax highlighting on emacs for C/C++ code

color-identifiers-mode does this for variables, if I understand your question correctly. rainbo-identifiers-mode too, I think. Screenshot is from the former one.
5 votes
Accepted

Best C++ indexer?

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 ...
  • 320
5 votes

Binding compile command to a key for c++ code

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 ...
  • 12.3k
5 votes
Accepted

Add include paths to flycheck and to company-irony?

Irony-mode maintainer's here. Also using ROS at work. If you use catkin, then you can get along with irony-mode easily. I do not have ROS at my disposal right now but you should be able to do ...
5 votes
Accepted

Displaying the type of variable in C++ code with cursor

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: int main() { auto var = 1.0; return var; } Having the ...
5 votes
Accepted

How to us a shortcut to add semicolon to end of current line?

If you ever want to add shortcuts functionality where you have control over the exact behavior, it's worth learning a little emacs-lisp. This kind of functionality is trivial to write. (global-set-key ...
  • 7,441
4 votes

Using Emacs as a full-featured C/C++ IDE

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 ...
  • 7,328
4 votes

Is there a yasnippet producing a prepopulated doxygen comment?

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 ...

Only top scored, non community-wiki answers of a minimum length are eligible