rust-lang / rust-lang/rust-mode
Support `beginning-of-line-text` and `(fill-paragraph 't)` in comments
Nobody has claimed this yet.
- Dominant language
- Emacs Lisp
- Stars
- 1.3k
- Forks
- 198
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by examining rust-mode's handling of comments when beginning-of-line-text and (fill-paragraph 't) run, focusing on how fill-prefix is identified. Compare the behavior with cc-mode using the examples in the issue; done means comment text starts after its markers and paragraph filling avoids extra leading spaces.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- emacs-lisp, rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100