2

First let me show a few things that work correctly. I am doing everything shown below using emacs -q foo.txt in a text buffer.

I make these settings first:

(setq comment-start "<<")
(setq comment-end ">>")
(setq comment-style 'box)
(setq comment-column 25)

I have this text buffer:

The quick brown fox
jumps over
the lazy dog

If I select the three lines with C-SPC C-n C-n C-n and press M-;. The buffer becomes like this:

<<<<<<<<<<<<<<<<<<<<<<<>>
<< The quick brown fox >>
<< jumps over          >>
<< the lazy dog        >>
<<<<<<<<<<<<<<<<<<<<<<<>>

All good. This is what I expected. Now I undo the change and revert the text to original state.

But now I change the comment style to:

(setq comment-style 'aligned)

Then I select the three lines of text again and press M-;. I get this:

<< The quick brown fox >>
<< jumps over >>
<< the lazy dog >>

The comment ends are not aligned. I was expecting this:

<< The quick brown fox >>
<< jumps over          >>
<< the lazy dog        >>

Is comment-style 'aligned supposed to align the comment ends or not? If not what is 'aligned supposed to do?


The value of comment-styles on my Emacs:

((plain nil nil nil nil "Start in column 0 (do not indent), as in Emacs-20")
 (indent-or-triple nil nil nil multi-char "Start in column 0, but only for single-char starters")
 (indent nil nil nil t "Full comment per line, ends not aligned")
 (aligned nil t nil t "Full comment per line, ends aligned")
 (box nil t t t "Full comment per line, ends aligned, + top and bottom")
 (extra-line t nil t t "One comment for all lines, end on a line by itself")
 (multi-line t nil nil t "One comment for all lines, end on last commented line")
 (box-multi t t t t "One comment for all lines, + top and bottom"))
4
  • 1
    According to the docs (C-h v comment-styles), your expectation is correct. Please add the value of the variable comment-styles to your post. Commented Apr 23, 2023 at 13:54
  • @FranBurstall Added the value of comment-styles to the post. What results do you get when you perform the steps in my post with emacs -q foo.txt? Do you get aligned comment ends? Commented Apr 24, 2023 at 7:34
  • 1
    It looks to me that the documented (user-expected) behavior doesn't match the factual one. It's probably a good candidate for M-x report-emacs-bug (at least, the related docs could be added / improved), unless someone clarifies the behavior here.
    – Y. E.
    Commented Apr 24, 2023 at 10:45
  • @LoneLearner I get the same behaviour as you. Looks like a bug. Commented Apr 24, 2023 at 16:27

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.