Questions tagged [cc-mode]

Major mode for C, C++, Objective-C, Java, CORBA IDL, Pike, AWK. Included in GNU Emacs and XEmacs.

22 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
8
votes
1answer
189 views

Custom indentation for specific lines?

I currently try to figure out, how I can handle some lines specifically without messing up the indentation of the rest of the buffer. Consider the following function MyFunc as an example: void MyFunc(...
4
votes
0answers
2k views

Support C++11 syntax in c++-mode

I want correct indentation with my C++ code. The following piece of code indents properly. It nicely indents the access label and the member declaration independently. class Test : public Base { ...
2
votes
0answers
43 views

Derived mode from CC Mode: how do I write one?

Where is the definitive, up-to-date guide on how to write a derived mode from CC Mode. I have a mode that's malfunctioning and thought I might just rewrite it, but information I find is spotty and ...
2
votes
0answers
251 views

How to set indentation style substatement-open offset parameter from .dir-locals.el?

Within CC mode, for C and C++ files inside a directory, I'd like to have the open braces following a case/do/for/if/while not indented, whatever the style is and without having to change anything in ....
2
votes
0answers
53 views

Is it possible to detect C/C++/Java variable declarations.?

I'm writing a minor mode to handle automatic spacing of operator characters, but I'm having some trouble with C/C++. The problem is that I can't figure out how to tell in general whether a * is a ...
1
vote
1answer
41 views

Altering syntax highlighting for a particular expression

In c-mode, I would like all lines beginning with exec sql to have that expression grey and the rest of the line in the default face. How might I achieve that?
1
vote
0answers
26 views

How to avoid annoying `auto-fill` behaviour in `c-mode` comment?

Recently I write quite a lot comments for c/c++ files. I use auto-fill-mode for comment auto format. But I found a quite annoying problem: whenever I input SPC at the end of a comment line, the cursor ...
1
vote
1answer
60 views

How do I suppress indentation after labels in Groovy?

I'm writing some Groovy code, and in my unit tests I have something like the following: def testFoo(){ given: //setup statement 1 //setup statement 2 //... when: //Execute ...
1
vote
0answers
43 views

Enable `cc-mode` documentation highlightning per minor mode

I am writing a minor mode for enabling support for JML within Java files. I realized the syntax highlighting with cc-mode's support for documentation comments. It works if I set c-doc-comment-style ...
1
vote
0answers
181 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: ...
1
vote
0answers
127 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 ...
1
vote
0answers
340 views

Emacs as environment for iOS development

Is there any modes which may improve development experience for nowadays ObjC (syntax highlight for method calls, properties, blocks, literals, lightweight generics, modern keywords)? Ideally with ...
1
vote
0answers
467 views

c-indent-line-or-region: Variable binding depth exceeds max-specpdl-size

I'm trying to define a new major mode using define-generic-mode and want to try reusing c-indent-line-or-region for my indent-line-function. I've inserted (set (make-local-variable 'indent-line-...
1
vote
0answers
95 views

How does forward-list work for “<>” in c++-mode?

I am trying to understand how forward-list matches template delimiters <> in c++-mode. forward-list in lisp.el calls scan-lists with the appropriate arguments. The documentation for scan-lists ...
0
votes
0answers
25 views

How to fix indentation of anonymous structures in function argument position in C?

I've been stumbling upon this constantly. Suppose that I have a function that accepts a structure, or a pointer to a structure: struct s { int n; char c; }; void f(struct s *s); I'd like to ...
0
votes
0answers
12 views

How to get first nested parameter indented based on outermost function

I would like to get the following cc-mode indentation behavior (c-basic-offset is 4): outerFunction(innerFunction( parameter1, parameter2)); However I would like to maintain arglist aligned ...
0
votes
0answers
7 views

How to prevent indentation from depending on identifier length?

I noticed that a lot of Emacs indentation styles cause the indentation of one line to depend on the length of identifiers in the previous line, for example: void usage(char* name) { fprintf(...
0
votes
0answers
46 views

c-electric-brace and smartparens pairs

Within c-mode it is possible to configure a style and with c-hanging-braces-alist it is possible to relocate braces like { and } to separate lines, inserting whitespace and so on. Th function which ...
0
votes
0answers
42 views

`scad-mode` (derived from CC Mode) hangs Emacs. How to debug/fix?

I have found that scad-mode.el, a derived mode from CC Mode, which can be found here: https://github.com/openscad/openscad/blob/master/contrib/scad-mode.el hangs emacs if I type #( into the window,...
0
votes
0answers
30 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, ...
0
votes
2answers
451 views

prevent auto indent temporarily for multi line conditional, loops, etc

When I am writing in c-mode, I prefer to write multi-line control statements in the following way. if( cond1 && cond2 || cond3 ) { /* stuff */ } for( i = 0; i < N; ++i ) { ...
0
votes
0answers
87 views

Make Helm Projectile to show external sources

I'm pretty new to emacs (was using Vim), primarily using it for Ruby on Rails projects. At my free time, I like to write some C code for STM32 micro-controllers. Unlike RoR project, C project for ...