From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Emanuel Berg Newsgroups: gmane.emacs.help Subject: Re: Fill all comments in a buffer? Date: Tue, 03 Oct 2017 05:58:38 +0200 Message-ID: <86zi98sx01.fsf@zoho.com> References: <9df19993-ab92-cb92-bd83-97ed68d4317d@nottheoilrig.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1507003167 32283 195.159.176.226 (3 Oct 2017 03:59:27 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 3 Oct 2017 03:59:27 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Oct 03 05:59:21 2017 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dzEMa-0007f5-6K for geh-help-gnu-emacs@m.gmane.org; Tue, 03 Oct 2017 05:59:20 +0200 Original-Received: from localhost ([::1]:56044 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dzEMh-0005c4-Gj for geh-help-gnu-emacs@m.gmane.org; Mon, 02 Oct 2017 23:59:27 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33240) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dzEMB-0005b7-Ro for help-gnu-emacs@gnu.org; Mon, 02 Oct 2017 23:58:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dzEM7-00046s-VD for help-gnu-emacs@gnu.org; Mon, 02 Oct 2017 23:58:55 -0400 Original-Received: from [195.159.176.226] (port=58183 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dzEM7-00046I-Nv for help-gnu-emacs@gnu.org; Mon, 02 Oct 2017 23:58:51 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1dzELu-0003SS-9Y for help-gnu-emacs@gnu.org; Tue, 03 Oct 2017 05:58:38 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: help-gnu-emacs@gnu.org Original-Lines: 38 Original-X-Complaints-To: usenet@blaine.gmane.org Mail-Copies-To: never Cancel-Lock: sha1:hbfeRtyMzEd43lVGodarYzM9m+4= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:114509 Archived-At: 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