From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Bob Rogers Newsgroups: gmane.emacs.devel Subject: Re: Multiple bugs in lisp-mode M-q on paragraphs within #|..|# comments Date: Sat, 24 Mar 2007 20:23:48 -0400 Message-ID: <17925.49428.760951.346087@rgrjr.dyndns.org> References: <17925.31957.782297.513252@rgrjr.dyndns.org> <87lkhmflwk.fsf@stupidchicken.com> <17925.37199.346999.399423@rgrjr.dyndns.org> <4605A120.6030400@gmx.at> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="h/bUBMGtyQ" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1174782244 30945 80.91.229.12 (25 Mar 2007 00:24:04 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 25 Mar 2007 00:24:04 +0000 (UTC) Cc: emacs-devel To: martin rudalics Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Mar 25 01:23:57 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HVGWa-0006CM-6M for ged-emacs-devel@m.gmane.org; Sun, 25 Mar 2007 01:23:56 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HVGYe-0001uk-BK for ged-emacs-devel@m.gmane.org; Sat, 24 Mar 2007 19:26:04 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HVGYa-0001ph-VO for emacs-devel@gnu.org; Sat, 24 Mar 2007 20:26:00 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HVGYZ-0001n8-2I for emacs-devel@gnu.org; Sat, 24 Mar 2007 20:26:00 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HVGYY-0001mt-TZ for emacs-devel@gnu.org; Sat, 24 Mar 2007 19:25:58 -0500 Original-Received: from c-24-34-111-252.hsd1.ma.comcast.net ([24.34.111.252] helo=rgrjr.dyndns.org) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1HVGWT-0006qu-V4 for emacs-devel@gnu.org; Sat, 24 Mar 2007 20:23:50 -0400 Original-Received: (qmail 1404 invoked by uid 500); 25 Mar 2007 00:23:48 -0000 In-Reply-To: <4605A120.6030400@gmx.at> X-Mailer: VM 7.19 under Emacs 22.0.96.1 X-detected-kernel: Linux 2.4-2.6 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:68511 Archived-At: --h/bUBMGtyQ Content-Type: text/plain; charset=us-ascii Content-Description: message body text Content-Disposition: inline Content-Transfer-Encoding: 7bit From: martin rudalics Date: Sat, 24 Mar 2007 23:07:28 +0100 I suppose `comment-end' is "" in you buffer. That seems to be the case, at least initially. Then the problem is with the following stretch of code in `fill-paragraph': (and fill-paragraph-handle-comment ;; Our code only handles \n-terminated comments right now. comment-start (equal comment-end "") (let ((fill-paragraph-handle-comment nil)) (fill-comment-paragraph arg))) We have to find something more intelligent here. Is this really the place? If I add a call to error just before the fill-comment-paragraph call, none of the four bugs cause it to be called. It might be better to recognize Lisp "#|...|#" comments explicitly at a point where we know we're dealing with Lisp. The attached patch is a total hack, but it seems to relieve the symptoms of the first three bugs (and changes that of the fourth). This style of comment can be nested, so the hack will get confused if still inside a comment but after an inner comment. The changed symptoms of the fourth bug suggest that the bounds passed to the fill-region-as-paragraph call are wrong. But I'll bet someone else can do better. -- Bob --h/bUBMGtyQ Content-Type: text/plain Content-Disposition: inline; filename="lisp-comment-fill-1.patch" Content-Transfer-Encoding: 7bit Index: lisp/emacs-lisp/lisp-mode.el =================================================================== RCS file: /sources/emacs/emacs/lisp/emacs-lisp/lisp-mode.el,v retrieving revision 1.200 diff -c -r1.200 lisp-mode.el *** lisp/emacs-lisp/lisp-mode.el 5 Mar 2007 03:20:58 -0000 1.200 --- lisp/emacs-lisp/lisp-mode.el 25 Mar 2007 00:13:20 -0000 *************** *** 1246,1252 **** paragraph of it that point is in, preserving the comment's indentation and initial semicolons." (interactive "P") ! (or (fill-comment-paragraph justify) ;; Since fill-comment-paragraph returned nil, that means we're not in ;; a comment: Point is on a program line; we are interested ;; particularly in docstring lines. --- 1246,1266 ---- paragraph of it that point is in, preserving the comment's indentation and initial semicolons." (interactive "P") ! (or (if (save-excursion ! (and (re-search-backward "#|\\||#" nil t) ! (equal (match-string 0) "#|"))) ! ;; We are in a "#|...|#" comment. [Assuming we haven't been ! ;; fooled by quoted strings or ;-comments.] ! (let ((start (save-excursion ! (forward-paragraph -1) ! (point))) ! (end (save-excursion ! (forward-paragraph 1) ! (point)))) ! (message "trying it") ! (fill-region-as-paragraph start end justify)) ! ;; Try "normal" comment paragraph fill. ! (fill-comment-paragraph justify)) ;; Since fill-comment-paragraph returned nil, that means we're not in ;; a comment: Point is on a program line; we are interested ;; particularly in docstring lines. --h/bUBMGtyQ Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --h/bUBMGtyQ--