all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Emanuel Berg <moasen@zoho.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Fill all comments in a buffer?
Date: Tue, 03 Oct 2017 05:58:38 +0200	[thread overview]
Message-ID: <86zi98sx01.fsf@zoho.com> (raw)
In-Reply-To: 9df19993-ab92-cb92-bd83-97ed68d4317d@nottheoilrig.com

Jack Bates wrote:

> Is there a way to fill (reflow) all comments
> in a buffer? Similar to how I can spellcheck
> all comments with
> ispell-comments-and-strings?
>
> I can go to each comment and type M-q -- I'd
> like to do it all at once.

Is that a good idea? It happens that people
have code blocs commented out. That code will
be screwed if filled.

Can't you do it manually? If you can't (too
much), probably you have too long files!

Anyway, try this.

Change the "^;;" to the syntax of your
language(s) or get it from Emacs (careful!).
Beware one line comments, like this

    i++; // increase i by 1

should not be filled, so stick to the ^ is what
I'd (not) do :)

(defun fill-all-comments ()
  (interactive)
  (goto-char (point-min))
  (while (search-forward-regexp "^;;" (point-max) t) ; NOERROR
    (let ((start (point)))
      (fill-comment-paragraph) )))

-- 
underground experts united
http://user.it.uu.se/~embe8573




  reply	other threads:[~2017-10-03  3:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-02 21:32 Fill all comments in a buffer? Jack Bates
2017-10-03  3:58 ` Emanuel Berg [this message]
     [not found] ` <mailman.676.1507003137.27995.help-gnu-emacs@gnu.org>
2017-10-03  4:12   ` Emanuel Berg
  -- strict thread matches above, loose matches on Subject: below --
2017-10-03  2:52 Jack Bates

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86zi98sx01.fsf@zoho.com \
    --to=moasen@zoho.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.