apheleia icon indicating copy to clipboard operation
apheleia copied to clipboard

astyle broken formatter

Open Icy-Thought opened this issue 1 year ago • 7 comments

You have to manually add the code provided below to your emacs configuration file for the apheleia astyle formatter to function as intended. Maybe we should upstream the solution that hlissner has come up with?

(setf (alist-get 'astyle apheleia-formatters)
        '("astyle" (mapconcat 'identity (apheleia-formatters-locate-file "--options=" ".astylerc"))))

Source: https://github.com/doomemacs/doomemacs/issues/7718

Icy-Thought avatar Dec 25 '24 10:12 Icy-Thought

Wait, I'm a bit confused by the discussion there. What's the proposed change? Seems like the mapconcat thing and the modified command-line option is contributed by the original reporter, who is confused that those modifications are not taking effect? What is the bug in Apheleia? I.e. what happens with the default configuration that's wrong?

raxod502 avatar Jan 24 '25 00:01 raxod502

IIRC (not using astyle), but executing apehelia-format-buffer did not change the formatting of the viewed buffer. (command below) https://github.com/radian-software/apheleia/blob/e112fe1bf4fdaef1c9ab741590ac45b06dc01f76/apheleia-formatters.el#L24-L25

But with the apheleia-formatters entry for astyle (found in doomemacs), it worked fine. I wonder what caused the issue tbh.

Icy-Thought avatar Jan 24 '25 08:01 Icy-Thought

So the difference is... what? Using --options=.astylerc instead of --options .astylerc?

raxod502 avatar Jan 24 '25 22:01 raxod502

From https://astyle.sourceforge.net/astyle.html#_Option_Files, that appears to be the case.

Icy-Thought avatar Jan 24 '25 23:01 Icy-Thought

OK, I would accept that as a contribution. (Ideally it would be tested to verify that that's actually the issue.)

raxod502 avatar Jan 25 '25 18:01 raxod502

I didn't submit a PR because I am not the owner of that code. But I can always create a PR if you'd like.

Icy-Thought avatar Jan 25 '25 20:01 Icy-Thought

Up to you.

raxod502 avatar Jan 26 '25 21:01 raxod502