Sav
Sav

Reputation: 83

Using clang-format over tramp

I have clang installed in a docker container which I'm able to interact with in emacs through tramp. The motivation is to replicate a dev-container like environment in emacs. As much as possible, at any rate (as per this post).

I can access the docker container's filesystem through the path /docker:container_name:/path/to/file. I'm using the clang-format package in emacs, which allows me to run clang-format on buffers. I'd like it to use the clang-format binary installed in the container. By default, it will look on my local filesystem, so have fiddled with the clang-format.el. It used to read:

(defcustom clang-format-executable
  (or (executable-find "clang-format")
      "clang-format")
  "Location of the clang-format executable.
   A string containing the name or the full path of the executable."
  :group 'clang-format
  :type '(file :must-match t)
  :risky t)

and have bodged it to the following:

(defcustom clang-format-executable "/docker:container_name:/usr/bin/clang-format"
  "Location of the clang-format executable.
   A string containing the name or the full path of the executable."
  :group 'clang-format
  :type '(file :must-match t)
  :risky t)

But when trying to run clang-format in a buffer, I get:

apply: Searching for program: No such file or directory, /docker:container_name:/usr/bin/clang-format

Clearly I'm doing something stupid, but I'm sort of out of ideas at this point.

Upvotes: 0

Views: 122

Answers (0)

Related Questions