all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Fill all comments in a buffer?
@ 2017-10-02 21:32 Jack Bates
  2017-10-03  3:58 ` Emanuel Berg
       [not found] ` <mailman.676.1507003137.27995.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 4+ messages in thread
From: Jack Bates @ 2017-10-02 21:32 UTC (permalink / raw)
  To: help-gnu-emacs

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.

Thanks!



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Fill all comments in a buffer?
@ 2017-10-03  2:52 Jack Bates
  0 siblings, 0 replies; 4+ messages in thread
From: Jack Bates @ 2017-10-03  2:52 UTC (permalink / raw)
  To: help-gnu-emacs

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.

Thanks!



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Fill all comments in a buffer?
  2017-10-02 21:32 Fill all comments in a buffer? Jack Bates
@ 2017-10-03  3:58 ` Emanuel Berg
       [not found] ` <mailman.676.1507003137.27995.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 4+ messages in thread
From: Emanuel Berg @ 2017-10-03  3:58 UTC (permalink / raw)
  To: help-gnu-emacs

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




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Fill all comments in a buffer?
       [not found] ` <mailman.676.1507003137.27995.help-gnu-emacs@gnu.org>
@ 2017-10-03  4:12   ` Emanuel Berg
  0 siblings, 0 replies; 4+ messages in thread
From: Emanuel Berg @ 2017-10-03  4:12 UTC (permalink / raw)
  To: help-gnu-emacs

YT wrote:

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

Wait, what does the 5th line do?

Try

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

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-10-03  4:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-02 21:32 Fill all comments in a buffer? Jack Bates
2017-10-03  3:58 ` Emanuel Berg
     [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

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.