I installed clang-format package from the MELPA repository.

I added it to the load-path in my init file.

Whenever I try to use it it says:

Searching for program: No such file or directory, clang-format

I would assume this is because I don't have some kind of style file. Is this correct?

If so, how would I create such a file?


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

  • 1
    The problem was that I didn't have clang-format installed on my machine. I thought it was an emacs-only package. Your answer gave me the hint. sudo apt install clang-format – Rtsne42 Jan 13 '17 at 18:33
  • So to choose a particular version of clang-format: (setq clang-format-executable "/usr/bin/clang-format-5.0") – Fred Schoen Sep 3 '18 at 11:54
  • That's right. You can try it yourself. – Felipe Lema Sep 3 '18 at 12:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.