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
29
votes
2 answers

Making php-mode (and other cc-mode derived modes) compatible with Emacs 23

I am using Emacs 23 and php-mode.el 1.5.0. When I have this in my .emacs: (require 'php-mode) I get this error message when Emacs starts: Warning (initialization): An error occurred while loading `/Users/kdj/.emacs': error: `c-lang-defconst' must…
Kristopher Johnson
  • 81,409
  • 55
  • 245
  • 302
19
votes
1 answer

Java Coding Style & Emacs cc-mode configuration

I'm using GNU/Emacs HEAD with the included cc-mode (c-version 5.32.2) on a GNU/Linux Debian machine. I'm trying to define a custom style to manage the Code Conventions for the Java Programming Language, Android's Code Style Guidelines for…
Renaud
  • 8,783
  • 4
  • 32
  • 40
9
votes
7 answers

How can can I get emacs to insert closing braces automatically

I've just started using emacs, and there's one feature I'd really like, and searching around a bit was fruitless. I hope someone else has done this because I don't want to learn elisp just yet. void foo() I would like typing an "{" to cause…
Bwmat
  • 4,314
  • 3
  • 27
  • 42
5
votes
1 answer

Emacs: How to automatically insert space after colon in cc-mode derivatives

Suppose I have this code: { "type" : "home", "number":"212 555-1234" } I want my emacs to automatically insert space after colon in some modes. Particularly I'm using javascript-mode based on cc-mode. Can it help?
Ilya Khaprov
  • 2,546
  • 14
  • 23
5
votes
2 answers

Overload a Keybinding in Emacs

I've looked through a number of other questions and el files looking for something i could modify to suit my needs but I'm having trouble so I came to the experts. Is there anyway to have a key behave differently depending on where in the line the…
kladd
  • 159
  • 1
  • 9
4
votes
3 answers

Emacs Indentation Function

I am working in cc-mode in Emacs and I find the indentation very very annoying. As a VIM user, I'm pretty much used to longer indents, as well as having the luxury of hitting tab to tab as much as I want. In Emacs, my TAB is mapped to goto-line.…
darksky
  • 20,411
  • 61
  • 165
  • 254
4
votes
1 answer

Indenting template arguments in Emacs

I'm having no luck getting Emacs (cc-mode) to indent multiline template arguments. Here's an example line: typedef ::boost::zip_iterator< ::boost::tuple< vector::const_iterator, vector::const_iterator > >; I'd like the second line to…
AFoglia
  • 7,968
  • 3
  • 35
  • 51
4
votes
2 answers

Emacs cc-mode tab behavior

Pressing tab multiple time doesn't move text to the right. Is there is a way to make it behave like Visual Studio's smart indent? First tab indents, subsequent tabs move text to the next tab stop. Thank you.
pic11
  • 14,267
  • 21
  • 83
  • 119
4
votes
2 answers

How do I disable electric indent on RET but still keep other electric characters (e.g., ‘{’)?

In Emacs 24.4, the default indentation behavior has been changed—new lines are now automatically indented. From the release notes: *** `electric-indent-mode' is now enabled by default. Typing RET reindents the current line and indents the new…
user3426575
  • 1,723
  • 12
  • 18
4
votes
0 answers

Emacs indentation of objective-c block syntax

I'm using objc-mode and in general the indentation works quite well, but I am having difficulty with the following code. dispatch_async(dispatch_get_main_queue(), ^{ [self someMethod]; }); Emacs tries to indent it like…
Austin Taylor
  • 5,437
  • 1
  • 23
  • 29
4
votes
1 answer

irony-mode does not pick up include paths

I've recently started using irony-mode for completion in emacs (24.3.1). However, I seem unable to add additional system include paths to package. I have this code in my config: (defun ac-cc-mode-clang-hooks () (yas/minor-mode-on) …
elemakil
  • 3,681
  • 28
  • 53
4
votes
2 answers

Make Emacs less aggressive about indentation

Emacs reindents the current line whenever I type certain things, like ";" or "//". This is pretty annoying, since there are a whole lot of places where it isn't smart enough to indent correctly. How do I disable this feature? I still want to be…
Ken
  • 5,337
  • 3
  • 28
  • 19
4
votes
1 answer

How to highlight #ifdef #endif in emacs?

I don't know if cc-mode or cedet is providing something alike that but that must not be such hard to realize I hope. What I want is to change background for code in C++ / C# source files between #ifdef (something) and #endif. Is there mode option…
cnd
  • 32,616
  • 62
  • 183
  • 313
3
votes
2 answers

How can I override the default mode file in Emacs?

I would like to override the default Emacs cc-mode.el with another file. In my .emacs, I have the following line: (add-to-list 'load-path "/usr/home/smooth/emacs" t) This works correctly to load local Emacs configuration files. For example (require…
3
votes
2 answers

What does the elisp error "Wrong type argument: sequencep, t" mean?

I'm trying to byte-compile cc-mode 5.31.3 using emacs 23.1.1 as follows: $ emacs -batch --no-site-file -q -f batch-byte-compile *.el But two of the files are failing to compile (in addition to numerous warnings): In…
Adam Rosenfield
  • 390,455
  • 97
  • 512
  • 589
1
2 3 4