Questions tagged [cc-mode]

CC Mode is an Emacs and XEmacs mode for editing C and other languages with similar syntax; currently C++, Objective-C, Java, CORBA's IDL, Pike and AWK. It's a standard package in both Emacs and XEmacs.

CC Mode supports the editing of K&R and ANSI C, C++, Objective-C, Java, CORBA's Interface Definition Language, Pike and AWK files.

Note that the name of this package is CC Mode, but there is no top level cc-mode entry point. All of the variables, commands, and functions in CC Mode are prefixed with c-thing, and c-mode: c++-mode, objc-mode, java-mode, idl-mode, pike-mode, and awk-mode entry points are provided. This package is intended to be a replacement for c-mode.el, c++-mode.el and awk-mode.el.

Official repository: http://cc-mode.sourceforge.net/

46 questions
3
votes
0 answers

Emacs/CC-Mode doesn't indent arguments to templated functions starting with a curly bracket

Consider the following snippet of C++ code, indented using cc-mode in Emacs: auto good1 = f(a, {1, 2}); // ((arglist-cont-nonempty 1 15)) auto bad1 = f<1>(a, {1, 2}); // ((inexpr-statement) (block-open 36)) auto…
Claudius
  • 550
  • 3
  • 14
3
votes
1 answer

Display the binary version of hex value in status bar

I am doing a lot of embedded C programming right now, which means that I am writing things like this all the time: (ioe_extra_A & 0xE7) It would be super useful, if when put my cursor on the 0xE7, emacs would display "0b1110 0111" in the status bar…
DrLock
  • 43
  • 4
3
votes
1 answer

Controlling the indent/offset for CMake in emacs

I am using cmake-mode which I thought came out of cc-mode (ed: comments below indicate this was incorrect). For some reason my indents (e.g. in an if() block) are coming out as 2 spaces, even though my c-basic-offset is set to 4. Does anybody know…
BobDoolittle
  • 1,326
  • 1
  • 12
  • 21
3
votes
2 answers

New line and autoindent braces in ccmode in Emacs

I'm using Emacs. I want that when I write this (| is the point): for (int i=0; i
Juan Herrero Diaz
  • 833
  • 1
  • 7
  • 17
3
votes
3 answers

Movement through argument list

I'm a C++ programmer using a setup consisting of cc-mode and CEDET and of course our beloved emacs (v24.2). A feature I'm missing is a function that moves point fast through a list of arguments. Consider this example: void takesManyArgs( int a1,…
elemakil
  • 3,681
  • 28
  • 53
3
votes
1 answer

How to enable auto filling in emacs' c-mode?

all Now I'm editing c sources with emacs under c-mode. How ever auto-fill-mode doesn't seem to work at all. Here how I enabled and tried to use it. M-x auto-fill-mode (enable auto-fill-mode) Typed in a line longer than auto-fill size(which 80…
kjee
  • 359
  • 5
  • 19
2
votes
2 answers

Emacs c-mode can't recognize utf-8?

I need to read one C++ head file which has some Chinese and was encoded using utf-8. Emacs should recognize this encoding, but it turns out: Then, I changed it to text-mode, it works: I also tested for python-mode, lisp-mode, etc, all works except…
Chris Zheng
  • 1,509
  • 1
  • 15
  • 20
2
votes
2 answers

Emacs indentation

In Emacs, the line gets indented only after hitting return (in cc-mode). Is that normal? Can that be changed to indent automatically when it hits a new line? How do I look at variables, for example There are a number of predefined styles. Take a…
darksky
  • 20,411
  • 61
  • 165
  • 254
2
votes
1 answer

CC-mode indentation of C++ lambda functions with a return type that has template parameters

I am using CC-mode in Emacs that was installed with apt on Ubuntu 20.04. It formats code as follows: #include int main() { auto f1 = [](int a) { return std::vector({a}); }; auto f2 = [](int a) ->…
tanabe13f
  • 45
  • 3
2
votes
1 answer

Custom C preprocessor format in Emacs cc-mode

I'm generating a C source file from a Mako template. Mako templates have directives similar to C preprocessor directives, except that they start with % instead of #. For example: %if some_condition: /* Condition is true */ %else: /* Condition…
Jmb
  • 18,893
  • 2
  • 28
  • 55
2
votes
1 answer

Adjusting Alignment Rules for UCFS-Chains in D

Is there a way to tweak the alignment rules in c-derived modes, in my case d-mode to indent D-style UFCS-Chains such as foreach (file; dirPath.expandTilde() .buildNormalizedPath() …
Nordlöw
  • 11,838
  • 10
  • 52
  • 99
2
votes
1 answer

Indentation for initializer list in Constructor is wrong

I'm using emacs 24.3 and I've encountered the following problem with emacs indentation engine and the new C++11 initializer lists. Let me give you an example: Consider a class Class which has a member of type std::vector named m_vector. Emacs…
elemakil
  • 3,681
  • 28
  • 53
2
votes
1 answer

`hideshow` mode not working with lines starting with comments

I'm using emacs (24.3.1) along with cc-mode and hideshow for programming c++. I am working on a project, where the coding styles requires that any keywords present in the header file must be repeated in the source file. In case that this is not…
elemakil
  • 3,681
  • 28
  • 53
1
vote
1 answer

How to customize c-doc-comment-style to use reStructuredText as documentation comment style?

Emacs uses c-doc-comment-style to specify the documentation comment style to use in cc-mode. I'd like to use reStructuredText, or rst, for documentation comments. There's an rst-mode for reStructuredText files, with rst-font-lock-keywords, but I…
Jani
  • 853
  • 8
  • 20
1
vote
1 answer

CC-Mode 5.32.1 with Latest Emacs

I'm trying cc-mode 5.32.1 with Emacs trunk. When I compile I get these errors cc-mode.el:596:29:Error: Symbol's function definition is void: byte-compile-obsolete Compiling file /home/per/pnw/emacs/cc-mode-5.32.1/cc-styles.el at Sun Oct 2 12:28:53…
Nordlöw
  • 11,838
  • 10
  • 52
  • 99