Skip to content

Support beginning-of-line-text and (fill-paragraph 't) in comments #549

Open
@jeberger

Description

@jeberger

I'm not sure if this should be two issues or one, but they feel related.

When programming in C/C++ with cc-mode, when the cursor is inside a comment and I hit M-<home> (which is bound to beginning-of-line-text), then the cursor moves to the first character of the comment text after the comments symbols, e.g.:

   // Comment text
      ^ `beginning-of-line-text` moves the cursor here

In rust-mode, the cursor moves to the first non-whitespace character (same as back-to-indentation).

Possibly related: when I hit C-u M-q (bound to (fill-paragraph 't)) to justify a paragraph in a comment, rust-mode adds extra spaces to the begnining of some lines:

   /// Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
   ///  in reprehenderit  in  voluptate velit  esse  cillum dolore  eu
   /// fugiat nulla pariatur.

whereas cc-mode is able to justify the text correctly:

   /// Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
   /// in  reprehenderit  in voluptate  velit  esse  cillum dolore  eu
   /// fugiat nulla pariatur.

I believe both issues may be related to identifying and setting the fill-prefix when these functions are called inside comments. It would be nice to have those working as in cc-mode.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions