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 IIS in conjunction with the OutSystems development platform, which does code-generation
I haven't play enough with this and usually use mocks, but I wonder what
One of the reasons I usually don't use an IDE for development is that
I usually use C++ stdlib map whenever I need to store some data associated
I usually do not use Sql Server Management Studio, I usually use Linqpad to
When I am unsure about some thing for a project, I usually use a
I am getting to grips with Windows Azure. I usually use NInject as my
I heard that if you use port 443 (the port usually used for https)
I use Assert.Fail a lot when doing TDD. I'm usually working on one test
I usually, almost without thinking anymore, use forward declarations so that I won't have

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.