Skip to main content
8 votes
Accepted

How can I set up clang-format in emacs?

You need to generate a .clang-format file in your project's root, with the command clang-format -style=llvm -dump-config > .clang-format. More info on this page.
Ian's user avatar
  • 1,503
8 votes

How to clang-format the current buffer on save?

Install the clang-format package and add the following hooks to your emacs init: (defun clang-format-save-hook-for-this-buffer () "Create a buffer local save hook." (add-hook 'before-...
ideasman42's user avatar
  • 8,925
6 votes
Accepted

How to use clang-format package?

load_path is used for emacs lisp libraries, what you're looking for is exec-path: (setq exec-path (append exec-path '("/path/to/clang-format"))) Or you can customize clang-format-executable
Felipe Lema's user avatar
5 votes
Accepted

clang-format malfunctioning(?) Or am I not fully understanding how clang-format works?

I found the same thing (not following my styles as defined in a .clang-format file, which happens to be in the parent directory in my case), and I think that the problem is in the way that the assume-...
William Gallafent's user avatar
3 votes

How can I set up clang-format in emacs?

You set clang-format-style to "file". In that case, clang-format.el will first look for a .clang-format file. It it finds one, it will use it. Otherwise, it will check the clang-format-fallback-style. ...
Philipp Claßen's user avatar
1 vote
Accepted

Can someone help me with lsp C++20 features recognition?

This is not really a question about Emacs, but about clangd. The whole point of LSP, or the Language Server Protocol, is that it is a standard protocol editors can use to talk to Language Servers like ...
db48x's user avatar
  • 18.5k
1 vote
Accepted

"No EmacSQL SQLite binary available" while running Org-Roam on GUIX

The OP checked that the sqlite3 binary is installed on his system and can be found by shells and through the executable-find mechanism. But the emacs-sqlite package uses emacsql-sqlite-ensure-binary (...
NickD's user avatar
  • 31.4k
1 vote

How to make connection to arduino LSP server?

You need to install either the lsp-mode or eglot-mode Emacs package. (If you have a new enough Emacs then eglot will be built–in). Each of these does basically the same job (teaching Emacs how to talk ...
db48x's user avatar
  • 18.5k
1 vote
Accepted

lsp mode problems: not enabled, and clangd include file not found

The problem was that clang++ apparently looks for the "higher gcc version", and then expects that the corresponding g++ libraries and headers are installed. For some reasons, this was not ...
user52366's user avatar
  • 141
1 vote

How to disable lsp-clangd server if there is no dominating compile_commands.json

Rationale It is unreasonable for developers to expect either of lsp-mode or flymake-mode Elisp modes to predict all of the arcane C/C++ compiler options necessary for basic checks such as location of #...
bgoodr's user avatar
  • 361
1 vote
Accepted

clang-format package looking for wrong executable

First of all, .bashrc doesn’t help since it’s for non-login shell if I remember correctly. Secondly, I believe a “path” in exec-path should end with “bin”, like it would be in environment variable ...
TerryTsao's user avatar
  • 1,216
1 vote

How to clang-format the current buffer on save?

Building on ideasman42's answer, I wanted to be able to turn this feature on an off, per buffer or globally. Minor modes to the rescue : (use-package clang-format) (defun clang-format-save-hook() &...
Charles G's user avatar
  • 165
1 vote
Accepted

How do you add command line options to flycheck's C++ checker?

You don't change the executable, but rather modify flycheck's variables that get translated into a command. In your case, you have to change them like: (setq flycheck-clang-language-standard "c++11") ...
Felipe Lema's user avatar
1 vote
Accepted

company-mode clang error

I had this error recently, too. I think you could solve it with some clang-flags in the company-clang-arguments user option. You have to specify your Include-Paths and the Library-Paths and link the ...
user12841's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible