From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: Filling Block Comment Date: Tue, 21 Mar 2006 11:53:43 -0500 Organization: Bell Sympatico Message-ID: <877j6ng2ub.fsf-monnier+gnu.emacs.help@gnu.org> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1143491687 3005 80.91.229.2 (27 Mar 2006 20:34:47 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 27 Mar 2006 20:34:47 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Mar 27 22:34:46 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FNyPx-0002JO-LG for geh-help-gnu-emacs@m.gmane.org; Mon, 27 Mar 2006 22:34:26 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FNyPx-0008Ga-2i for geh-help-gnu-emacs@m.gmane.org; Mon, 27 Mar 2006 15:34:25 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns14feed!worldnet.att.net!207.35.177.252!nf3.bellglobal.com!nf1.bellglobal.com!nf2.bellglobal.com!news20.bellglobal.com.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:BEPLJdSgzTB/KDzbAYaIKEBY2Ug= Original-Lines: 35 Original-NNTP-Posting-Host: 70.55.140.81 Original-X-Complaints-To: abuse@sympatico.ca Original-X-Trace: news20.bellglobal.com 1142960023 70.55.140.81 (Tue, 21 Mar 2006 11:53:43 EST) Original-NNTP-Posting-Date: Tue, 21 Mar 2006 11:53:43 EST Original-Xref: shelby.stanford.edu gnu.emacs.help:138302 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:34024 Archived-At: > (require 'newcomment) > (setq comment-start "/*") > (setq comment-end "*/") > (set (make-local-variable 'fill-paragraph-function) > 'fill-comment-paragraph) > the block comment > /* xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz */ > is filled as (something like) > /* xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz > /* xyz xyz xyz */ > instead of > /* xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz > xyz xyz xyz */ Indeed, the filling code doesn't know much about comments and often gets it wrong. > How do I make `fill-comment-paragraph' work with block comments? You don't? Instead, write your own function that will try to find the beginning/end of the enclosing comment and then calls fill-region-as-paragraph. I had started to work on extending fill.el so that it used syntax-tables to correctly respect comment and string boundaries when filling, but never got far enough to get something really usable. Stefan