GNU bug report logs - #3900
fill-comment-paragraph fails (e.g.) in perl-mode POD

Previous Next

Package: emacs;

Reported by: Bob Rogers <rogers-emacs <at> rgrjr.dyndns.org>

Date: Wed, 22 Jul 2009 03:55:05 UTC

Severity: normal

Fixed in version 24.5

Done: Alan J Third <alan <at> idiocy.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 3900 in the body.
You can then email your comments to 3900 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#3900; Package emacs. (Wed, 22 Jul 2009 03:55:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Bob Rogers <rogers-emacs <at> rgrjr.dyndns.org>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Wed, 22 Jul 2009 03:55:05 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Bob Rogers <rogers-emacs <at> rgrjr.dyndns.org>
To: emacs-pretest-bug <at> gnu.org
Subject: fill-comment-paragraph fails (e.g.) in perl-mode POD
Date: Tue, 21 Jul 2009 23:49:51 -0400
[Message part 1 (text/plain, inline)]
   To reproduce (in trunk or 23.0.96):

   1.  Stuff the following six lines of "code" (two of them blank) into
the "foo.pl" file:

=head1 Testing

This is a test case line with lots of stupid text.
This is a test case line with a C<#> and lots of stupid text.

=cut

   2.  "emacs -Q foo.pl"

   3.  Move the cursor to any point in the fourth line (the one with
"C<#>") and type "M-q".  This will produce the following user-unfriendly
error:

	Search failed: "\\(^\\|\\s-\\);?#+ *"

   This directed my attention to the following code near the end of
fill-comment-paragraph:

	    (save-excursion
	      (goto-char beg)
	      (if (looking-at fill-prefix)
		  nil
		(re-search-forward comment-start-skip)))

which seems to make two bad assumptions:  That comment-start-skip is
never nil (though its documentation asserts otherwise), and that it
matches before the end of the buffer (which is trivially false at EOB).
The attached patch removes these assumptions, and makes the "Search
failed" error go away.

   Unfortunately, this isn't enought to fix perl-mode:  Instead of
signalling an error, it does nothing, which is not right, either.  The
deeper problem there is that M-q in perl-mode doesn't distinguish
between POD syntax and Perl code proper, and tries to treat the "#" as
the start of a single-line comment, even though that is not possible in
POD.  But fixing that would require a more intrusive patch, and the
fill-comment-paragraph code is wrong in any case, so I submit this fix
separately on the chance that it might be considered suitable for 23.1.

					-- Bob Rogers
					   http://www.rgrjr.com/

[fill-comment-para-fix.patch (text/plain, inline)]
Index: lisp/textmodes/fill.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/textmodes/fill.el,v
retrieving revision 1.223
diff -c -r1.223 fill.el
*** lisp/textmodes/fill.el	8 Apr 2009 04:02:35 -0000	1.223
--- lisp/textmodes/fill.el	22 Jul 2009 03:44:20 -0000
***************
*** 976,986 ****
  	    (max comstart beg) end justify nil
  	    ;; Don't canonicalize spaces within the code just before
  	    ;; the comment.
! 	    (save-excursion
! 	      (goto-char beg)
! 	      (if (looking-at fill-prefix)
! 		  nil
! 		(re-search-forward comment-start-skip))))
  	   ;; Make sure we don't return nil.
  	   t))))))
  
--- 976,987 ----
  	    (max comstart beg) end justify nil
  	    ;; Don't canonicalize spaces within the code just before
  	    ;; the comment.
! 	    (and comment-start-skip
! 		 (save-excursion
! 		   (goto-char beg)
! 		   (if (looking-at fill-prefix)
! 		       nil
! 		       (re-search-forward comment-start-skip nil t)))))
  	   ;; Make sure we don't return nil.
  	   t))))))
  

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#3900; Package emacs. (Thu, 14 Jan 2016 20:24:01 GMT) Full text and rfc822 format available.

Message #8 received at 3900 <at> debbugs.gnu.org (full text, mbox):

From: Alan J Third <alan <at> idiocy.org>
To: Bob Rogers <rogers-emacs <at> rgrjr.dyndns.org>
Cc: 3900 <at> debbugs.gnu.org
Subject: Re: bug#3900: fill-comment-paragraph fails (e.g.) in perl-mode POD
Date: Thu, 14 Jan 2016 20:22:29 +0000
Bob Rogers <rogers-emacs <at> rgrjr.dyndns.org> writes:

>    To reproduce (in trunk or 23.0.96):
>
>    1.  Stuff the following six lines of "code" (two of them blank) into
> the "foo.pl" file:
>
> =head1 Testing
>
> This is a test case line with lots of stupid text.
> This is a test case line with a C<#> and lots of stupid text.
>
> =cut
>
>    2.  "emacs -Q foo.pl"
>
>    3.  Move the cursor to any point in the fourth line (the one with
> "C<#>") and type "M-q".  This will produce the following user-unfriendly
> error:
>
> 	Search failed: "\\(^\\|\\s-\\);?#+ *"

Hi, Sorry it's taken so long to respond to your bug report.

I can't reproduce this in either Emacs 24.5 or Emacs 25. Can you confirm
whether you're still seeing this behaviour in a recent version of Emacs?
-- 
Alan Third




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#3900; Package emacs. (Sat, 16 Jan 2016 03:27:02 GMT) Full text and rfc822 format available.

Message #11 received at 3900 <at> debbugs.gnu.org (full text, mbox):

From: Bob Rogers <rogers-emacs <at> rgrjr.dyndns.org>
To: Alan J Third <alan <at> idiocy.org>
Cc: 3900 <at> debbugs.gnu.org
Subject: Re: bug#3900: fill-comment-paragraph fails (e.g.) in perl-mode POD
Date: Fri, 15 Jan 2016 22:26:21 -0500
   From: Alan J Third <alan <at> idiocy.org>
   Date: Thu, 14 Jan 2016 20:22:29 +0000

   Hi, Sorry it's taken so long to respond to your bug report.

No problem.

   I can't reproduce this in either Emacs 24.5 or Emacs 25. Can you confirm
   whether you're still seeing this behaviour in a recent version of Emacs?
   -- 
   Alan Third

Nope; works for me, too.

					-- Bob




bug marked as fixed in version 24.5, send any further explanations to 3900 <at> debbugs.gnu.org and Bob Rogers <rogers-emacs <at> rgrjr.dyndns.org> Request was from Alan J Third <alan <at> idiocy.org> to control <at> debbugs.gnu.org. (Sat, 16 Jan 2016 20:49:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 14 Feb 2016 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 125 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.