Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 524145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:32:13+00:00 2026-05-13T08:32:13+00:00

I usually use Geany or Hi-Tide under Debian (GNU/Linux) for firmware development, mainly C

  • 0

I usually use Geany or Hi-Tide under Debian (GNU/Linux) for firmware development, mainly C (but also reading old assembler). I document code using single-line comments, and it really annoys me when I retype something and have to manually re-break every following line to keep it in the 80-character margin.

Is there a text editor that can re-wrap consecutive single-line comments (and do this automatically while I type)? That is, given:

/// This is a really long line that should have been wrapped at "that" but was not.
/// This sentence is in the same
/// paragraph as the last.

…I want an editor that will re-wrap this to

/// This is a really long line that
/// should have been wrapped at "that"
/// but was not. This sentence is in
/// the same paragraph as the last.

…preferably doing this sensibly while I type.

I’ve tried:

  • Hi-Tide (based on Eclipse 3.3)
  • Geany
  • jEdit
  • UniversalIndentGUI + a bunch of prettifiers (I couldn’t find any formatters that worked, and it’s not a great workflow either)
  • GVim – next line begins //should have been… instead of /// should have been…

Update: just to elaborate on my accepted answer – I’ve gone with the snapshot emacs and an extra filladapt mode was also required

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T08:32:13+00:00Added an answer on May 13, 2026 at 8:32 am

    In Emacs, to start automatic wrapping, enter auto-fill-mode. To set the line width, run C-u ⟨columns⟩ C-x f.
    Emacs, or really CC Mode, will anticipate your commenting structure, so that typing
    /// This is a really long line that shoul will result in

    /// This is a really long line that
    /// shoul‸

    And you can refill a paragraph at any time with M-q.

    If you want to do refills automatically with each keypress, well there may well be some interal command or third-party library out there, but off-hand you can use this elisp code:

    ;;; Can't advise SELF-INSERT-COMMAND, so create a wrapper procedure.
    (defun self-insert-refill (n)
      (interactive "p")
      (self-insert-command n))
    
    ;;; Advise SELF-INSERT-REFILL to execute FILL-PARAGRAPH after every
    ;;; keypress, but *only* if we're inside a comment
    (defadvice self-insert-refill (after refill-paragraph)
      (let ((face (or (get-char-property (point) 'read-face-name)
                      (get-char-property (point) 'face))) )
    
        (if (and (eq face 'font-lock-comment-face)
                 (not (string= " " (this-command-keys))))  ; Spaces would get deleted on refill.
            (fill-paragraph))))
    
    (ad-activate 'self-insert-refill)
    
    (add-hook 'c-mode-hook
      ;; Remap SELF-INSERT-COMMAND to be SELF-INSERT-REFILL.
      (local-set-key [remap self-insert-command] 'self-insert-refill) ))
    

    This is probably not very robust or in keeping with best-practice, and likely not wholly satisfactory, as it won’t work for general editing, e.g. C-d and backspace, and it slows down the editor somewhat, but it’s a start.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I usually use Netbeans for PHP development, but have recently had to move to
I usually use Eclipse, but I'd also like to use Netbeans sometimes, especially the
I usually use IIS in conjunction with the OutSystems development platform, which does code-generation
I usually use Visual Studio Team System 2008 Source Control Explorer with TFS, but
I usually use sql parameters with queries, but in this case I need to
I usually use expressions like this CommandArgument='<%# Container.DataItemIndex.ToString() %> ' But I could not
I usually use 4 white spaces to indent C programs, but in order to
I usually use Nunit but in my current project I am using MSTest. Now
I usually use .Net but now I'm playing Scala in IntelliJ 10.5.1. It's interesting
I usually use CamelCase for PHP coding, but when it come to input fields

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.