GNU bug report logs -
#15004
24.3; fill-paragraph on perl-mode indented comment at start of buffer
Previous Next
To reply to this bug, email your comments to 15004 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#15004
; Package
emacs
.
(Thu, 01 Aug 2013 23:44:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Kevin Ryde <user42 <at> zip.com.au>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Thu, 01 Aug 2013 23:44:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Starting from emacs -Q,
(progn
(switch-to-buffer "xx")
(erase-buffer)
(insert " # aa aa\n")
(insert " # bb bb\n")
(insert " # cc cc\n")
(insert " # dd dd\n")
(goto-char (point-min))
(perl-mode)
(fill-paragraph nil))
gives
# aa aa
# bb bb cc cc dd dd
whereas I hoped the fill-paragraph would include the first line too,
# aa aa bb bb cc cc dd dd
The problem is only if the lines are at the start of the buffer.
I noticed this under filladapt which narrows to its desired target
region and fills that. The problem occurs both at actual start of
buffer and when narrowed.
I couldn't tell where it might go wrong except that it might be related
to perl-mode using comment-start-skip "\\(^\\|\\s-\\);?#+ *" which has a
\\(\\) group to demand preceding whitespace if not at start of line.
If you change it to
(set (make-local-variable 'comment-start-skip) ";?#+[ \t]*")
then the fill correctly includes the first line.
In GNU Emacs 24.3.1 (i486-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
of 2013-05-29 on blah.blah, modified by Debian
System Description: Debian GNU/Linux 7.0 (wheezy)
Configured using:
`configure '--build' 'i486-linux-gnu' '--build' 'i486-linux-gnu'
'--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib'
'--localstatedir=/var/lib' '--infodir=/usr/share/info'
'--mandir=/usr/share/man' '--with-pop=yes'
'--enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.3/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.3/site-lisp:/usr/share/emacs/site-lisp'
'--with-crt-dir=/usr/lib/i386-linux-gnu' '--with-x=yes'
'--with-x-toolkit=lucid' '--with-toolkit-scroll-bars' '--without-gconf'
'build_alias=i486-linux-gnu' 'CFLAGS=-g -O2 -fstack-protector
--param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall'
'LDFLAGS=-Wl,-z,relro -Wl,-znocombreloc'
'CPPFLAGS=-D_FORTIFY_SOURCE=2''
Important settings:
value of $LANG: en_AU
locale-coding-system: iso-latin-1-unix
default enable-multibyte-characters: t
Added tag(s) confirmed.
Request was from
Stefan Kangas <stefan <at> marxist.se>
to
control <at> debbugs.gnu.org
.
(Wed, 12 Aug 2020 22:56:02 GMT)
Full text and
rfc822 format available.
bug Marked as found in versions 28.0.50.
Request was from
Stefan Kangas <stefan <at> marxist.se>
to
control <at> debbugs.gnu.org
.
(Wed, 12 Aug 2020 22:56:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#15004
; Package
emacs
.
(Wed, 21 Sep 2022 12:34:02 GMT)
Full text and
rfc822 format available.
Message #12 received at 15004 <at> debbugs.gnu.org (full text, mbox):
Kevin Ryde <user42 <at> zip.com.au> writes:
> Starting from emacs -Q,
>
> (progn
> (switch-to-buffer "xx")
> (erase-buffer)
> (insert " # aa aa\n")
> (insert " # bb bb\n")
> (insert " # cc cc\n")
> (insert " # dd dd\n")
> (goto-char (point-min))
> (perl-mode)
> (fill-paragraph nil))
>
> gives
>
> # aa aa
> # bb bb cc cc dd dd
>
> whereas I hoped the fill-paragraph would include the first line too,
>
> # aa aa bb bb cc cc dd dd
I can reproduce this on current master.
> The problem is only if the lines are at the start of the buffer.
Indeed, but that seems to be out of sheer luck: somehow the narrowing
goes from the newline previous to the start of comment when the lines
are not at the start of the buffer.
> I couldn't tell where it might go wrong except that it might be related
> to perl-mode using comment-start-skip "\\(^\\|\\s-\\);?#+ *" which has a
> \\(\\) group to demand preceding whitespace if not at start of line.
> If you change it to
>
> (set (make-local-variable 'comment-start-skip) ";?#+[ \t]*")
>
> then the fill correctly includes the first line.
>
I don't know why comment-start-skip is set this way in perl-mode. It
tries to do something more than just match the start of a comment and
skip to the body, and that confuses me.
Maybe it can be simplified to just "#+[ \t]*". Light testing shows no
problem with doing that. In fact, by no demanding preceding whitespace,
the following works as expected:
sub foo {
$bar = shift;#Just testing.
}
With point anywhere inside the function, C-M-q moves the comment to
comment-column.
This bug report was last modified 2 years and 266 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.