emacs-format-all-the-code icon indicating copy to clipboard operation
emacs-format-all-the-code copied to clipboard

Question: How to customize executable names

Open shanavas786 opened this issue 6 years ago • 8 comments

names of binary executable differ in some distributions like clang-format-7 or clang-format-8 in debian. Is there any way to customize the name of binary executable of a formatter ?

shanavas786 avatar Apr 01 '19 07:04 shanavas786

No, it has been a deliberate decision to use only one name for each executable. Are you on Unix (Mac/Linux) or Windows? The Unix convention is to set up PATH so that programs can be found with their usual names. I would solve this by making a symbolic link from e.g. clang-format-8 to clang-format (normally the package manager does this automatically when you install more than one version of the same program, choosing one of them to be the default version).

lassik avatar Apr 01 '19 08:04 lassik

If you need different versions of clang-format for different projects, unfortunately that is more complicated, because Emacs has only one global PATH shared by all buffers. Other people have had issues about that too, so if this is common we should think about a solution to project-specific formatters.

lassik avatar Apr 01 '19 08:04 lassik

Are you on Unix (Mac/Linux) or Windows?

Unix

I would solve this by making a symbolic link from e.g. clang-format-8 to clang-format

That is what I do currently.

If you need different versions of clang-format for different projects, unfortunately that is more complicated ... so if this is common we should think about a solution to project-specific formatters.

I don't need it now. But it seems allowing customization of executable name fixes that problem. user can simply override executable name in .dir-locals.el

shanavas786 avatar Apr 01 '19 08:04 shanavas786

But it seems allowing customization of executable name fixes that problem. user can simply override executable name in .dir-locals.el

We should do something like this since people keep asking about it. I'm a bit out of my depth on how to best do it so I'll try to get advice from an Emacs guru like Steve Purcell. In the best case we could come up with a solution that would benefit all Emacs packages, not just format-all.

lassik avatar Apr 01 '19 09:04 lassik

Great !!

similar packages like flycheck already allows this customization

shanavas786 avatar Apr 01 '19 09:04 shanavas786

Thanks for the tip :) Adding a variable to specify the path like that would be the obvious quick fix, but my intuition says there has to be a way to solve this in one place for all packages, so that each package can find the executables using their ordinary name (clang-format). I've seen several Emacs packages that have basically this exact same problem. We need a community leader with tons of experience to design a unified solution for all of us.

lassik avatar Apr 01 '19 11:04 lassik

I emailed Steve to ask for help with this problem. Let's see what happens.

lassik avatar Apr 04 '19 09:04 lassik

I've read #5, #6, and #33, and I think making :executable customizable would solve the discussed use cases in a conventional Emacs way. It would give a user the freedom to customize (executable path, alternative formatter for a specific major mode) in any situation (per project, per team, per development stage, etc).

ghost avatar Jul 03 '19 16:07 ghost