Closed taku0 closed 2 years ago
Hello @taku0,
My desired features were:
///
delimiter but no text/** lorem ipsum dolor sit amet... */
comments to put the delimiters on their own lineand I particularly did not want a separate keybinding: I wanted M-q
to always "do the right thing" based on the context of point.
That said, it's definitely possible that I did not choose the best way to implement this. 🙂 It was what I ended up with after researching Emacs filling behavior. I do recall that in my testing, comment-fill-column
did not seem to have the effect I desired. But I probably missed something.
I have tried out your implementation quickly and it seems to not only have my desired behavior. It also adds a feature I had not achieved yet: preserving indentation for bulleted lists! E.g. when the foo
, bar
, baz
lines are too long here:
/// - parameters:
/// - foo: labore et dolore magna aliqua...
/// - bar: labore et dolore magna aliqua...
/// - quux: labore et dolore magna aliqua...
This seems quite excellent. Thank you for your work on swift-mode!
Support
fill-region
and auto filling.We fill only comments and strings.
Removes
swift-mode:comment-fill-column
in favor ofcomment-fill-column
.@woolsweater, I have updated
swift-mode-fill.el
to supportfill-region
and auto filling. I have a few questions.Your previous PR essentially do the followings:
swift-mode:comment-fill-column
instead offill-column
.A and B is reasonable. No problems here.
For C, why not just setting
fill-column
locally?For D, why do you do it with
fill-paragraph
, rather than just bindswift-mode:comment-fill-function
to some key sequence? I have introduced a customization variableswift-mode:fill-paragraph-entire-comment-or-string
to reproduce the original behavior of your code.