Questions tagged [c-mode]

19 questions
6
votes
2 answers

Automatically closing #ifdef block when editing C code

When editing LaTeX code, the command latex-close-block inserts an \end{..} that matches the last unclosed \begin{..}. Very handy! Is there a similar command in c-mode that would close a pending #ifdef? Ideally, I would close #ifdef __A_COND__…
phs
  • 1,095
  • 6
  • 13
4
votes
2 answers

CC-Mode - Javadoc Comment Colors in C/C++

I've been fiddling around a bit with CC-mode lately and figured that since I prefer to comment my functions/classes with javadoc-like syntax, I'd like to use the built-in comment highlighting provided by the corresponding c-doc-comment-style. This…
Xaldew
  • 1,181
  • 9
  • 20
4
votes
1 answer

Semantic occur?

Is there a way to get an occur-style summary that contains all of the function definitions of the current file? Perhaps using semantic-mode? I'm particularly concerned about C. Emacs Lisp, Caml (tuareg-mode) and Haskell would be welcome additions,…
jch
  • 5,680
  • 22
  • 39
3
votes
1 answer

Colorizing `functions/variables' within comments in `c-mode'

I am working with the C-source code of Emacs using the built-in c-mode, and would like Emacs to automatically highlight functions and variables within comments with a different color: In the following example, how can I make pos-visible-in-window-p…
lawlist
  • 18,826
  • 5
  • 37
  • 118
2
votes
0 answers

Why did I get the U+2019 right single quotation mark not plain ASCII single quote in C mode?

In Emacs under C mode, why did the single quote key give me a U+2019 right single quotation mark, not a plain ASCII single quote? (That was corrected by a bot https://stackoverflow.com/posts/64104679/revisions) Does the U+2019 right single quotation…
Tim
  • 4,987
  • 7
  • 31
  • 60
2
votes
1 answer

Disable Prettify-Symbols for C-mode

I'm using doom emacs. It enables prettify-symbols in all modes (I think) by default, although I would like to disable it in c-mode. I have placed the following in my config.el file: (add-hook 'c-mode-hook (lambda () …
Aronurr64
  • 23
  • 3
2
votes
0 answers

Incorrect font locking/syntax hightlighting in c-mode

I've recently started using Emacs, and I'm having a problem with the font-locking in c-mode. I'm using the Monokai theme, and I'm finding that some tokens are being coloured incorrectly. The problem is that built in functions (strlen, malloc,…
J. Jaksche
  • 21
  • 2
2
votes
1 answer

Part II -- Colorizing `functions/variables' within comments in `c-mode'

I have implemented the solution of Yasushi Shoji in a previous thread -- Colorizing `functions/variables' within comments in `c-mode' -- to highlight Lisp function/variable names in c-mode comments that begin with a back-tick and end with a single…
lawlist
  • 18,826
  • 5
  • 37
  • 118
1
vote
1 answer

Make wide string literal for C/C++

Is there function/package that allows to make "wide string literals" as defined by C/C++ standards. That is, where one has to replace all non-ascii characters with escaped "\x.." sequences.
dilettant
  • 135
  • 2
1
vote
1 answer

how to change C-mode syntax so that the token @' is ignored?

I edit some files that are mostly C code but include a few special extension tokens. The tokens that give c-mode a problem are @' and @". I essentially want c-mode to ignore these two bigrams. The current behavior is that the quote (single or…
0
votes
1 answer

No syntax-highlight in c-mode *immediately* after enabling

I'm writing tests for color-identifiers-mode I co-maintain, and I stumbled upon a problem that after creating a buffer and enabling c-mode in it, there is no highlight over keywords. For example, if you open a usual C file containing struct foo;,…
Hi-Angel
  • 525
  • 6
  • 18
0
votes
0 answers

Make ff-find-other-file ignore include directive in C

I have a binding setup as described here, the problem is every time the cursor is on #include "file" it always tries to jump on this include. I want that no matter where there cursor is I get switched between header and the source files.
Yuki
  • 111
  • 5
0
votes
1 answer

Making function callable only whilst in `c-mode`

How can I make this function callable only whilst in c-mode? (defun nuket-c (actm) "Code templates for the C language" (interactive (list (let ( (cseq '("struct" "if" "ifelse" "ifladr" "ifword" "while" "swcnumic" "swcletr"…
Dilna
  • 1,173
  • 3
  • 10
0
votes
1 answer

How to auto run hide-ifdef-mode's hide-ifdefs command

I've been using hide-ifdef-mode with c-mode buffers for a while, but it is quite tedious to have to manually run hide-ifdefs (C-c @ h) every time a block of code containing preprocessors changes. Is there any way this can be run automatically? (for…
Luctins
  • 120
  • 7
0
votes
1 answer

cuda .cu files indentation issue. How i can set indentation for cuda .cu files to 4 spaces?

In my .emacs i have put following for cuda highlighting: (setq c-default-style '(("c++" . "linux") (java-mode . "java") (awk-mode . "awk") (other . "gnu"))) (setq…
skaushal
  • 101
  • 1
1
2