@greg from github
Ah, thanks, I wasn’t able to follow that URL here from GitHub for some reason.
Most Emacs modes will, when you’re in a comment, let you navigate, re-fill paragraphs, and re-indent things as text i.e. prose. So that’s what Racket Mode is doing here.
If you have some comment (whatever the contents, whether it’s prose or disable code, or whatever), and you don’t want it to be re-indented? Then I suggest, don’t re-indent it. :smile: Seriously don’t issue some command to re-indent it.
If there is some special minor-mode that it automatically/aggressively re-indenting things, for you, then we could look at how to disable that or make it avoid comments, I guess?
Or probably I’m misunderstanding some obvious use-case, in which case, sorry!, and please help me understand.
I think the use case is “I want to definitively indent all the code in my file, but I have some weird text formatting in my comments”
So “select all”, then “re-indent”.
I thought framework
already includes this as well…
I think Racket Mode is doing the “normal” thing here, which isn’t what @chansey97 wants, and it’s reasonable for them to want differently, I’m just not immediately sure what to do.
But I’ll take a look.
In fact, scheme-mode does the same thing as racket-mode. It will compress all the text inside #\| ...\|#
, obviously is not very ideal.
I was reviewing the Emacs docs and I think indent-region
really does mean “indent everything in the region, including comments”.
Of course it’s Emacs, everything is possible. So one could write a new indent-region-except-comments
command.
And it could ignore all comment lines, or, it could ignore only those using the #\| \|#
style.
If this is a major quality of life issue for you, I’d be happy to walk you through how to define such a command. Maybe we could that over on the GitHub issue comment thread, instead.
I think I have understand what you mean..
Yes it is just a quality of life issue, not urgent for me. We could discuss it on the GitHub issue comment thread. Thanks.
I posted a command definition https://github.com/greghendershott/racket-mode/issues/603#issuecomment-1068405777 If it’s not quite right, I’m happy to “pair program” with you.
I had no idea that was part of Framework. But - it is not interactive?
@greg It works very well. Thanks! Also, I have learned new knowledge from you. (elt (syntax-ppss) 4)
can check a pos in the comment! Thanks again.