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
1
vote
2 answers

Change Emacs C style not working

For Emacs CC-mode, I am trying to use the "bsd" style, but make it so that all lines default to indentation in increments of 4 instead of 8. In my .emacs file, I have put: (setq c-default-style "bsd" c-basic-offset 4) (setq c-indent-level…
dbmikus
  • 5,018
  • 6
  • 31
  • 37
1
vote
0 answers

Are bluetooth LE connections authenticated on Android?

I am having an issue where I cannot communicate with Bluetooth LE devices if my Android 8 phone, with common criteria mode enabled. When common criteria mode is disabled, everything works as expected. However, when I use my Android 6 phone with…
1
vote
1 answer

D-style Enum Syntax Support in cc-mode

I would like to extend cc-mode in Emacs to support D style enums as follow enum EnumName: EnumType { // enumerators... } The part : EnumType is the new part that needs to be supported. Does anybody know how to solve this or which function to…
Nordlöw
  • 11,838
  • 10
  • 52
  • 99
1
vote
0 answers

Changing Emacs CC mode indent style

I'm an emacs newbie and I've been trying to set up my indent style for cc-mode. I like to write code like this: if(true) { foo(); bar(); } But the default indent style is more like: if(true) { foo(); bar(); } It seems the…
1
vote
0 answers

Loading of d-mode fails in Emacs 24.3.50.4

When trying to load either d-mode.el or d-mode.elc (https://github.com/Emacs-D-Mode-Maintainers/Emacs-D-Mode) on recent snapshot of Emacs load fails as Loading d-mode... [4 times] Eval error in the `c-lang-defconst' for `c-typedef-decl-kwds' in…
Nordlöw
  • 11,838
  • 10
  • 52
  • 99
1
vote
1 answer

emacs batch indent vs. cc-mode access-label

I'm trying to batch indent source files using emacs. I'm using the command: $ emacs -batch Source.h -l emacs-format-file.el -f emacs-format-function where emacs-format-file.el contains: (defun emacs-format-function () (c-set-style "gnu") (setq…
bfallik-bamboom
  • 445
  • 5
  • 12
1
vote
3 answers

c++-mode-hook and c-mode-hook appears to run twice

I use this command to start emacs $ emacs -Q c-mode-test.el then I use C-xC-e to eval every line (require 'cc-mode) (add-hook 'c-mode-common-hook '(lambda () (print "hello"))) (add-hook 'c-mode-hook '(lambda () (print "hello…
spyder
  • 19
  • 2
  • 4
1
vote
4 answers

How to switch the point to previous line after a } was input?

I am working with emacs24 with cc-mode, I want to know how to make my emacs more "clever". After I type a }, it will auto insert a new line and indent as excepted. I want to know how to switch the point to previous line. For example, when i define a…
Yongqiang Zhou
  • 322
  • 1
  • 12
1
vote
2 answers

Is it possible to make C++ autohinting in emacs cc-mode?

I'm no sure if "autohinting" is correct word but I can explain for example when I write std:: I want to see the list of available things there, and same for "." and "->" , I hope that is possible.
cnd
  • 32,616
  • 62
  • 183
  • 313
0
votes
0 answers

How to add to lists defined with c-lang-defconst?

I'm trying to add a C++ mode hook to add C++11 keywords to the appropriate keyword lists (which are defined in lisp/progmodes/cc-langs.el in the Emacs source code). As a minimal example, I started with c-modifier-kwds and tried adding the following…
Matt
  • 21,026
  • 18
  • 63
  • 115
0
votes
1 answer

How to change the style of whole file in emacs cc mode ?

I am new to emacs and have a C file which is presently in gnu style in cc-mode. I have changed the style to linux by making the necessary changes in the .emacs file. I want to change the style of whole file (the prewritten code) to the style…
Pratik Singhal
  • 6,283
  • 10
  • 55
  • 97
0
votes
1 answer

Emacs 24: is there a way to use cc-mode's indentation?

I'm using Emacs 24, and although I'm not a very experienced Emacs Lisper, I've gotten things to work reasonably well. That said, I have no idea how to go about getting the standard css-mode to use cc-mode's indentation. I like the way cc-mode…
Ryan M
  • 647
  • 2
  • 6
  • 16
0
votes
1 answer

Emacs C++ indentation confused by Qt macros

Qt macros like Q_OBJECT and signals are messing up Emacs' indentation of my C++ code. How do I get Emacs to recognize the Qt macros and indent my C++ code accordingly? Emacs version: 23.3.1 CC mode version: 5.31.8 According to the Emacs wiki, my…
wsaleem
  • 594
  • 8
  • 25
0
votes
1 answer

how to freely format comments in cc-mode

I'm quite new to cc-mode and I'd like to configure it to allow me to freely format and use tabs in multiline comments. This is important to me because I want to use cog.py in my source file and need to be able to format the python source in the…
Dirk
  • 155
  • 1
  • 1
  • 8
0
votes
1 answer

Cannot properly require c-common-init and other c-mode functions

This must've happened during the last month or two. I'm not sure who's to blame for it, but now when I'm trying to byte-compile a mode derived from c-mode, Emacs can't find any of c-mode functions referenced in the derived mode. I've looked into…
user797257