[PATCH] clang-format.el: customization-support, MELPA-compatibility

Johann Klähn kljohann at gmail.com
Fri Jan 9 01:34:52 PST 2015


I have a prototype based on -output-replacements-xml, that needs some
cleaning up but basically does this. I could not find a built-in difflib
equivalent, so I chose to go down that road.
See https://github.com/kljohann/clang-format.el/tree/xml
Note that, when using this option, the JSON-header containing the
'-cursor' information is not returned, so I have to rely on markers
inserted into the buffer to keep the cursor position. At the moment I
create one marker for every window, which is most probably unnecessary and
can be removed.
Note that the version deletes all content of a file in case of an error
(for example, when the cursor is past the end of the file), so I wouldn't
point melpa at it yet.
I'm working on an improved version.

On Thu Jan 08 2015 at 4:32:22 PM Manuel Klimek <klimek at google.com> wrote:

> +cfe-commits (please do not cut that out during code review, the list is
> the source of truth for code reviews)
>
> Landed as r225447. Note that I'm planning to adapt it soon to not replace
> the whole buffer, but just apply the diffs (I'll cc' you on the patch for
> review, unless you object :)
>
> Cheers & thx!
> /Manuel
>
>
> On Wed Jan 07 2015 at 6:06:08 PM Johann Klähn <kljohann at gmail.com> wrote:
>
>> On Wed, Jan 7, 2015 at 5:14 PM, Manuel Klimek <klimek at google.com> wrote:
>> > +If called interactively uses the region or the current buffer if there
>> > +is no active region.  If no style is given uses `clang-format-style'."
>> >
>> > Doing full-buffer if nothing is selected is a usability problem if one
>> works
>> > in an existing codebase; if no region is selected, it should just use
>> the
>> > cursor position (which will get the current statement reflowed).
>> > The idea is that the user can do clang-format-buffer if they insist.
>> Excellent point.
>>
>> > +(put 'clang-format-executable 'risky-local-variable t)
>> >
>> > Any reason not to use :risky in the defcustom?
>> Oh, I thought I already did so. I must have accidently reverted that
>> change.
>>
>> Thanks for your feedback, find attached an updated patch.
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150109/97aed84f/attachment.html>


More information about the cfe-commits mailing list