Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [c-mode]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
6 votes
2 answers
586 views

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 #...
phs's user avatar
  • 1,239
4 votes
1 answer
217 views

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 (...
jch's user avatar
  • 5,750
4 votes
2 answers
829 views

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 ...
Xaldew's user avatar
  • 1,231
3 votes
1 answer
477 views

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 ...
lawlist's user avatar
  • 19.2k
2 votes
1 answer
352 views

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 ...
lawlist's user avatar
  • 19.2k
2 votes
1 answer
571 views

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-...
Aronurr64's user avatar
2 votes
0 answers
136 views

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/...
Tim's user avatar
  • 5,027
2 votes
0 answers
53 views

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 ...
J. Jaksche's user avatar
1 vote
1 answer
136 views

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's user avatar
  • 135
1 vote
1 answer
59 views

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 ...
Jonathan Cano's user avatar
0 votes
1 answer
140 views

Why does font-lock for comment work in cpp, but not in c?

This comment gets font-lock-comment-face in C++ mode, but not in C mode: /** * \file test.cpp * */ If I add another * to /** -> /***, it's working in C-mode, too... I'm not aware of any ...
Markus's user avatar
  • 481
0 votes
1 answer
696 views

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") ...
skaushal's user avatar
  • 101
0 votes
1 answer
79 views

Elisp-Function to always insert "*/" in C-Mode when "/*" was typed

I want to implement the functionality, that i wrote about in the title. Since searching the web for existing solutions didn't give me anything useful, i figured i would just try and implement it ...
Tim Hilt's user avatar
  • 307
0 votes
2 answers
53 views

Disable lsp-mode for certain buffers matching a specific pattern

What's the preferred way to not enter lsp-mode for certain buffers such as Emacs' backup files named for instance, app.c.~304fb1fe3650a354c4da16352f6c7be8bffd88cb~. I still want such files to open in ...
Nordlöw's user avatar
  • 507
0 votes
1 answer
59 views

c-mode inconsistent indentation (sometimes tabs, sometimes spaces)

I have the following line in my .emacs file: (setq-default indent-tabs-mode nil) but sometimes my indents still come through as tabs rather than spaces in c-mode. It is inconsistent; roughly 70% of my ...
tedtanner's user avatar
0 votes
1 answer
38 views

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 ...
Hi-Angel's user avatar
  • 766
0 votes
0 answers
31 views

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 ...
Yuki's user avatar
  • 111
0 votes
1 answer
29 views

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" "...
Dilna's user avatar
  • 1
0 votes
1 answer
153 views

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 ...
Luctins's user avatar
  • 120
0 votes
1 answer
176 views

Which value for topmost-intro-cont, to align variable names in c-mode?

In c-mode, how to align following code so, that the second variable name's starting character (A) is aligned below the first variable name's starting character (V)? static unsigned int V_name_1, ...
jue's user avatar
  • 4,576
0 votes
0 answers
65 views

How to define a custom code style for C/C++ to be shared with others?

I have my own code style setup in my init.el file, but would like to publish it for other developers to use. Is there a good template to use so projects can share their C/C++ code style between ...
ideasman42's user avatar
  • 8,826