chansey97
2022-3-15 19:06:08

@greg from github


greg
2022-3-15 19:09:31

Ah, thanks, I wasn’t able to follow that URL here from GitHub for some reason.


greg
2022-3-15 19:10:40

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.


greg
2022-3-15 19:11:53

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.


greg
2022-3-15 19:12:31

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?


greg
2022-3-15 19:14:09

Or probably I’m misunderstanding some obvious use-case, in which case, sorry!, and please help me understand.


samth
2022-3-15 19:14:48

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”


greg
2022-3-15 19:15:15

So “select all”, then “re-indent”.


sorawee
2022-3-15 19:16:15

I thought framework already includes this as well…


greg
2022-3-15 19:18:07

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.


greg
2022-3-15 19:18:12

But I’ll take a look.



chansey97
2022-3-15 19:26:41

In fact, scheme-mode does the same thing as racket-mode. It will compress all the text inside #\| ...\|#, obviously is not very ideal.


greg
2022-3-15 19:29:15

I was reviewing the Emacs docs and I think indent-region really does mean “indent everything in the region, including comments”.


greg
2022-3-15 19:29:40

Of course it’s Emacs, everything is possible. So one could write a new indent-region-except-comments command.


greg
2022-3-15 19:29:59

And it could ignore all comment lines, or, it could ignore only those using the #\| \|# style.


greg
2022-3-15 19:32:00

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.


chansey97
2022-3-15 19:44:20

I think I have understand what you mean..


chansey97
2022-3-15 19:54:17

Yes it is just a quality of life issue, not urgent for me. We could discuss it on the GitHub issue comment thread. Thanks.


greg
2022-3-15 19:54:27

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.


soegaard2
2022-3-15 20:03:52

I had no idea that was part of Framework. But - it is not interactive?


chansey97
2022-3-15 20:11:06

@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.