Questions tagged [c-mode]

16 questions
12
votes
1 answer

How to select (mark) the body of a C function in emacs?

I used to remember a key combination in c-mode to select a C function (i mean select the text between start and end of function for copying/killing etc) but i've since forgotten it and can't seem to find it anywhere. Does anyone remember what this…
horseyguy
  • 29,455
  • 20
  • 103
  • 145
9
votes
2 answers

Emacs comment-region in C mode

In GNU Emacs, is there a good way to change the comment-region command in C mode from /* This is a comment which extends */ /* over more than one line in C. */ to /* This is a comment which extends over more than one line in C. */ ? I have…
user181548
8
votes
4 answers

Turning on linum-mode when in python/c mode

I want to turn on linum mode (M-x linum-mode) automatically with python and c mode. I add the following code in .emacs, but it doesn't seem to work. (defun my-c-mode-common-hook () (line-number-mode 1)) (add-hook 'c-mode-common-hook…
prosseek
  • 182,215
  • 215
  • 566
  • 871
8
votes
2 answers

Mixing org-mode and c-mode in emacs

I'd like to mix org-mode and c-mode in Emacs. Everything inside a comment should be org-mode, the rests should be default major-mode c-mode: /* Org-mode here ** Section 1 text ** Section 2 text Org-mode should end here */ func1() { } I tried…
Konrad Eisele
  • 3,088
  • 20
  • 35
6
votes
1 answer

Emacs c-mode fill-paragraph with Doxygen Comments

I have a question that is very similar to Getting Emacs fill-paragraph to play nice with javadoc-like comments, but I wasn't sure if I would get many answers in a year old thread. Anyhow, I have C code that has some Doxygen comments that look like…
DuneBug
  • 1,543
  • 4
  • 15
  • 28
4
votes
5 answers

compile c++ code in c mode

Following is my code saved as .cpp file and .c file in .c it compiled fine, but threw the following error in .cpp test.cpp:6: error: initializer-string for array of chars is too long test.cpp:6: error: initializer-string for array of chars is too…
4
votes
1 answer

Emacs C-mode auto-indent fails after preprocessor macro

Emacs 24.2 for Windows. case TYPE_LONG: { <------- 65383 traceCodePath(20); tempLongVal = iterator_long(it); tempLongVal = 10; if (isBigEndian()) { swap_endian64(&tempLongValCon,…
Carthage
  • 298
  • 2
  • 8
3
votes
1 answer

Indenting deeply nested function calls

I would like emacs to indent my c/c++ code like this: auto LoopMatcher = forStmt(hasLoopInit(declStmt(hasSingleDecl(varDecl( hasInitializer(integerLiteral(equals(0)))))))).bind("forLoop"); (code taken from clang's AST matcher tutorial). In…
yorel
  • 177
  • 8
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
1
vote
1 answer

How can I get Emacs to ignore certain keywords?

I would like to tell emacs to treat some keywords (or regular expressions even better) as syntactic whitespace, or, in other words, to ignore them. For example: emacs highlighting and cedet misinterpret the code void function()…
fakedrake
  • 6,528
  • 8
  • 41
  • 64
1
vote
3 answers

Emacs c-mode autoloading failed

I want to load my file named "my-c-setup.el" when the c-mode is loading. So, I'm using the function "autoload". With my python setup, it works well : lang.el (autoload 'python-mode "my-python-setup" "" t) my-python-setup.el (require 'python) ;…
Sandro Munda
  • 39,921
  • 24
  • 98
  • 123
1
vote
1 answer

Emacs c-mode-hook runs when opening a php file

I created a hook function to activate irony-mode when working with c files. However, when I open a php file, these hook is also executed. Here is the code: (defun my-company-irony () (irony-mode) (unless (memq 'company-irony company-backends) …
1
vote
1 answer

How do I find the meaning of a particular fringe marking in emacs (c mode especially)?

There are various fringe markings that show up in c-mode in emacs (24.4.1). By inference I've figured out that the yellow >> is a warning of some sort, whereas the red >> is an error. But I'd like to be able to know explicitly what the c-mode…
zippy
  • 1,228
  • 10
  • 19
1
vote
1 answer

Emacs (24): cursor moves to column 0 when changing line in c-mode

I'm currently using Emacs 24.0.91.1 and every once in a while, the cursor behavior changes when I am in c-mode (with auto-fill-mode enabled). What I want is for the cursor to stay on the same column when I move one line up/down. However, every once…
hnrk
  • 11
  • 3
0
votes
0 answers

Configure javadoc font face in emacs c-mode

I'm having trouble getting emacs to recognise a block comment as javadoc (for Doxygen-style comments) in a C file: emacs -q M-x emacs-version is 24.0.92.1 (i686-pc-linux-gnu, GTK+ Version 2.24.7) of 2011-12-21 Add the following to a c-mode…
Ben
  • 1,339
  • 1
  • 11
  • 15
1
2