Questions tagged [c]

is for C source code editing, completions, formatting, compiling, folding, searching, executing, syntax checking, debugging, and other modern IDE features that Emacs supports.

Filter by
Sorted by
Tagged with
0
votes
1answer
115 views

CEDET semantic-complete-jump customization

When I search through project via semantic-complete-jump and tag is not unique (its defined in multiple places), I must hit <tab> to iterate through all possible places. Problem is, I horribly ...
0
votes
0answers
39 views

Stepping through c code in emacs

I am trying to step through code in emacs and am looking for a plugin which will displa the contents of an element when I hover over it. Is there any plugin like this currently? How do you step ...
1
vote
0answers
53 views

How do you guys use doxygen? [closed]

I'm curious about Doxygen, how do you guys manage documentation in C/C++ projects on emacs? I didn't find a good package that does it consistently. So far I did use gendoxy and doxymacs. I had ...
1
vote
2answers
203 views

cscope-minor-mode not enabled for C in emacs 25

I'm using Emacs 25 on Ubuntu 16.04, after a while spent on Emacs 24. One thing that I've noticed changed in version 25 is, cscope minor mode is not enabled by default when I edit C files, while it was ...
0
votes
0answers
19 views

some pointer declarations not colored

macs -nw fails to color code certain declarations of pointer arrays seemingly depending on the structure being pointed to. For example: SomeStruct *one[4] is all white (I have dark background), but ...
1
vote
0answers
32 views

Is there a package that show the value of constant variables? C/C++

I would like some package that show the variable value when I put cursor on it. The behavior that I expect can be seen in the image below. The image below is in vscode, I would like some package that ...
0
votes
0answers
25 views

company is not showing popup complete in c/c++

This is my company config The problem is that with python or lisp when I start to type the popup is shown immediately, but in C/C++ this don't occur. However if I type C-n or C-p the completition is ...
4
votes
1answer
56 views

Custom indentation for macros in C mode

I'm working in a codebase with an extensive use of function macros and I'm having some difficulty finding the correct way to set indentations with them. Specifically, we pass a lot of statement lists {...
1
vote
1answer
35 views

Adding rule to indentation

A code base I work on has the macro #define when break; case to make switch statements 'cleaner' However this causes problems with indentation, Is it possible to set the behavior of 'when' to be ...
0
votes
0answers
15 views

cmake-ide in projects with only make

What are my options to mimic cmake-ide in the projects that are not built with CMake? The features that I want the most are find-definition and autocomplete. For the compilation related features, ...
2
votes
0answers
115 views

Valgrind interface for emacs

Is there an interface similar to 'gdb-mi' for using Valgrind in emacs? What are some ways to use Valgrind inside emacs?
5
votes
2answers
198 views

How to transpose two arguments of a function call for C family languages?

How to swap two arguments for C function calls? eg: my_function(foo, bar, baz); ~~~~~~~~~~~~~^ (cursor location) Should be transposed to the right to make: my_function(bar, foo, baz); The simple ...
4
votes
3answers
2k views

Syntax highlight doxygen comments in C/C++? (c-doc-comment-style)

Is it possible to syntax highlight doxygen in C/C++ code? QtCreator and Vim both support basic highlighting so \param, \note... etc are highlighted differently.
1
vote
0answers
83 views

Doxygen style for c-doc-comment-style? [duplicate]

The option c-doc-comment-style supports javadoc, autodoc and gtkdoc. Is there a way to get doxygen support? (\returns, \note, \brief... etc)
1
vote
0answers
51 views

Align elements of a matrix to the right

I have a matrix in C++ Matrix<double> A = { {31, -13, 0, 0, 0, -10, 0, 0, 0}, {-13, 35, -9, 0, -11, 0, 0, 0, 0}, {0, -9, 31, -10, 0, 0, 0, 0, 0}, {0, 0, -10, 79, -30, 0, 0, 0, -...
0
votes
0answers
35 views

Too much time spent for emacs to open cpp in the project

I use ggtags in order to improve my efficiency. I follow the manual to setup emacs environment. https://tuhdo.github.io/c-ide.html However, during editing the cpp files in the projects. Chance are ...
1
vote
2answers
300 views

Org-babel. :flags in C code blocks dont work correctly anymore

I'm trying to run current code block #+HEADERS: :includes <math.h> <stdio.h> :flags -lm #+HEADERS: :var x=1.0 :var y=4.0 :var z=10.0 #+begin_src C :tangle trying double pi = 4*atan(1); ...
0
votes
2answers
79 views

How to configure C-M-q and TAB key to expand pre-existing TAB characters into spaces in C/C++ files

In C and C++ files, I want to configure the mode so that any time I request indentation, that it will always expand all of the embedded TAB characters in indentation (at the start of the line, and no ...
1
vote
1answer
175 views

#ifdef __cplusplus nuisance: How to prevent extra indenting?

If you ever wrote header files that have to be used by both C compiler and C++ compiler, you'd encounter this particular ifdef. This construct causes one to insert extra curly braces in the header ...
1
vote
2answers
239 views

What is the good resource for getting started using EMACS? [duplicate]

I have not used EMACS seriously in 20 years. I work on a Mac and am a vi/Eclipse person now. I want to switch back to EMACS for C and C++ programming. When I was researching EMACS add-on packages ...
-1
votes
1answer
51 views

Eshell - ./hello command not found(gcc)

emacs was installed by Msys32 on Win7 32bit! gcc can't run hello.c on eshell but on minibuffer, Why?
0
votes
1answer
99 views

How to find where a given function is called from in gtags

I am using gtags and can jump to where a function is defined. Howeve I am not able to find inside a function where it is begin called from. Is there anyway to find where a function is called from?
1
vote
3answers
3k views

How can I compile and run my C code from within Emacs like I would with the terminal?

I recently moved from Code::Blocks to Emacs to write C code. The one thing I don't like (because it takes too much time and effort for a simple and repetitive task) is the fact that I can't compile/...
1
vote
0answers
165 views

Is this a c-default-style? If not, how can i configure it?

I've just started using spacemacs and the docstrings for cc-styles are a bit daunting. I've also just started working on a new project in c, and would like to keep consistent with existing style: ...
0
votes
0answers
460 views

c/c++ disassembler for emacs and objdump

I'm trying to show assembly under the cursor in emacs (spacemacs, on mac os x) and although disaster.el does generate assembly with objdump, it fails to associate lines in source with lines in ...
1
vote
1answer
260 views

Compile and run C-Programs in Emacs

I'm currently learning C with a book that has many small code examples that the reader is supposed to write, run and experiment with. I'm using Emacs as my primary tool for everything that has to do ...
1
vote
1answer
828 views

Completion for variables in C using company-gtags, or not Semantic

I have a working C IDE without Semantic (too slow for me), from instructions here, with completion provided by company-gtags (I think. Maybe clang does something too?). Completion at point works for ...
8
votes
4answers
446 views

How do I disable ffap (find file at point) when the first two non-space characters in a line are '//'?

In Verilog/C/C++, comments can begin with //. Here's an example comment, //This is a comment I like to use the find-file-at-point feature. If my cursor is on the file name in `include "some_file.v"....
11
votes
2answers
4k views

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

I'm new to emacs and programming in general so please bear with me. I'm trying to use emacs as my C/C++ IDE, and I noticed that in CC mode the variables/functions seemed to be highlighted only during ...
0
votes
0answers
74 views

Performance issue of c-mode

When I'm pressing C-p/n moving the cursor around, the redisplaying is quite lagging. A profile of CPU give + command-execute 527 59% - ...
3
votes
2answers
7k views

How to compile and run a C++ file? [closed]

I don't know how to compile and run a C++ file in GNU Emacs. I searched on the various sites and stackexchange network, but from them what I understood was write something like make compile, and I don'...
1
vote
1answer
58 views

c-basic-offset is not influencing indentation of c/cpp files

No matter how I set this value I get this message when I try to describe it. Its value is 2 Original value was set-from-style Local in buffer .... ; *Global value is 3* I don't know what is ...
1
vote
0answers
44 views

annotate C's function list static or not in Speedbar

Is there any way to configure Speedbar to tag functions in the buffer static or extern for C? If not, how can I make it?
1
vote
0answers
47 views

Parsing non-standard C with gtags

I'm working with a codebase that's meant to be built with a proprietary C compiler using tons of esoteric language extensions. Ideally, I'd like to stick to my chosen environment as much as possible, ...
1
vote
2answers
1k views

How to run C/C++ code in Org Babel?

I'm trying to execute C and/or C++ snippets in Org Babel. For example, I want to be able to execute the following snippet with C-c C-c: #+begin_src C printf ("Hello World!"); #+end_src The ...
2
votes
2answers
94 views

Automatically insert a space in some C expressions

The corporate rules about indention forces us to surround our if conditions with spaces like this (in a C and C++ codebase) : if (<space>foo == bar<space>) { } Is there any emacs tool ...
0
votes
1answer
464 views

Stuck at input emacs gdb debugging C program /* enter doesn't end text input */

Hello I am novice programmer and I am trying to debug a simple C program, using getline (from the K&R book at the beginning) - input ends on newline. I have a problem with gdb on Emacs. When I ...
1
vote
0answers
155 views

Is CEDET/semantic obsolete? How to analyze C code for source transformation tasks?

Reading through some CEDET docs I found that the author herself recommends "to use Semantic only as source of information, and perform names completion using other packages". Does this advice also ...
5
votes
2answers
867 views

How to use C++ comments “//” in c-mode?

In c-mode comment-region is adding /* */ style comments. Is there a way to default to using C++ style // prefix in C source files instead?
2
votes
0answers
95 views

How to modify behavior of syntax highlighting without editing the original source?

There is a bug in C/C++ comment highlighting (bug 11865) Where the fix appears to be to modify the value of c-font-lock-doc-comments Is there a way to do this in my emacs config, instead of having ...
0
votes
0answers
221 views

How to toggle C/C++ multi-line comments using preprocessor `#if 0` … `#endif`?

Is it possible to configure C/C++ multi-line comments to comment/uncomment selected text using the preprocessor? eg: Before: // a comment Some(code); /* some comment */ After: #if 0 //...
0
votes
1answer
48 views

Linking Multiple Implementation Files in C on Emacs

I need help with linking multiple c source code files on emacs. Could anyone show me the way on how to work this out? Thanks!
6
votes
2answers
4k views

emacs cscope integration basics

I am a long term eclipse CDT user migrating to emacs (ver. 23.3.1), because I have to work on a large C codebase accessible only through a telnet/ssh shell. After going through several online guides, ...
1
vote
0answers
109 views

Structures are defined using a macro, flycheck gives errors

In our source code we surround structures with a macro (MKDIFF) that serves as a flag for the Makefile system. It does not expand into anything, just a flag. Flycheck (understandably) flags these ...
2
votes
1answer
665 views

Gray-out preprocessor conditionals

Is there a package that will gray out or hide the false portion of a c preprocessor macro? #define ENABLE 1 #if ENABLE bool hide = false; #else bool hide = true; #endif In the above example, ...
0
votes
2answers
467 views

flycheck include path from ede

I have a setup where I use EDE from CEDET for C projects development (among other things) and the real good flycheck on-the-fly syntax checking. I have defined ede-cpp-root-project in my .emacs file ...
3
votes
1answer
1k views

C/C++ coding in Emacs org-mode's babel

I'm not finding a lot of examples/documentation for the non-REPL world of C/C++ in Emacs org-mode babel. For example, is there a way to break a program up into separate source code blocks, i.e., a ...
7
votes
1answer
182 views

How can I build/package Emacs so that the C source files are installed to a standard find-function-C-source-directory?

I want to be able to view C source code of Emacs functions. For example, I want to be able to do M-: (find-function 'message). Emacs prompts me for directory the C sources, so it can set find-...
1
vote
1answer
510 views

Change C indent style for specific project?

I have in my ~/.emacs.d/init.el: (use-package google-c-style ;; provides the Google C/C++ coding style :ensure t :config (add-hook 'c-mode-common-hook 'google-set-c-style)) However, a ...
1
vote
0answers
107 views

Getting gdb to work for this project

For this project, I cannot seem to get M-x gdb to work in Emacs 25.1 (on Ubuntu 14.04.5 64-bit if it matters - this should be the case for any Ubuntu-based Linux in general I imagine). Steps to ...