GNU bug report logs - #12583
latest org-mode changes exposes bug in `comment-forward' in newcomment.el

Previous Next

Package: emacs;

Reported by: Le Wang <l26wang <at> gmail.com>

Date: Sat, 6 Oct 2012 11:08:01 UTC

Severity: minor

Done: Chong Yidong <cyd <at> gnu.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 12583 in the body.
You can then email your comments to 12583 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-gnu-emacs <at> gnu.org:
bug#12583; Package emacs. (Sat, 06 Oct 2012 11:08:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Le Wang <l26wang <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 06 Oct 2012 11:08:02 GMT) Full text and rfc822 format available.

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

From: Le Wang <l26wang <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: latest org-mode changes exposes bug in `comment-forward' in
	newcomment.el
Date: Sat, 6 Oct 2012 19:07:21 +0800
Repro with Emacs head:

1. emacs -Q
2. create new org file
3. insert "# blah"
4. C-a
5. M-: (comment-forward 1)

The problem is that `comment-use-syntax' changed from 'undecided to
nil in org.el, which intern exposed a problem in `comment-forward':

It contains:

    (re-search-forward comment-end-skip nil 'move)

But comment-end-skip can validly be nil according to documentation.

-- 
Le




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12583; Package emacs. (Sat, 06 Oct 2012 12:51:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Le Wang <l26wang <at> gmail.com>
Cc: 12583 <at> debbugs.gnu.org
Subject: Re: bug#12583: latest org-mode changes exposes bug in
	`comment-forward' in newcomment.el
Date: Sat, 06 Oct 2012 08:49:40 -0400
> 1. emacs -Q
> 2. create new org file
> 3. insert "# blah"
> 4. C-a
> 5. M-: (comment-forward 1)

Before using the comment-* functions, you need to call comment-normalize-vars.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12583; Package emacs. (Sat, 06 Oct 2012 15:55:01 GMT) Full text and rfc822 format available.

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

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Stefan Monnier'" <monnier <at> iro.umontreal.ca>,
	"'Le Wang'" <l26wang <at> gmail.com>
Cc: 12583 <at> debbugs.gnu.org
Subject: RE: bug#12583: latest org-mode changes exposes bug in
	`comment-forward'in newcomment.el
Date: Sat, 6 Oct 2012 08:53:42 -0700
> Before using the comment-* functions, you need to call 
> comment-normalize-vars.

Which comment-* functions?  All of them?

Why don't you add a specific guideline about this to the code comments or to
some doc string?

The doc string of `comment-normalize-vars' says, BTW, that it is the functions
that are autoloaded from newcomment.el that should call `c-n-v'.  But you seem
to be saying that those are not the only ones.

It is also the case that not all functions that are autoloaded from
newcomment.el call `c-n-v'.  So what exactly is the proper criterion?  (Or do
some such functions in newcomment.el perhaps need to be corrected to call
`c-n-v'?)

For my own use, I wonder whether I should be calling `c-n-v' before I make use
of `comment-search-forward'.  That function has no autoload cookie, so it does
not fit your prescription, and I have not been calling `c-n-v' and have not
noticed any problem, but I wonder anyway, since you brought this up.  Just when
is it necessary or useful to call `c-n-v'?

BTW, why are there so many things besided commands that have autoload cookies in
newcomment.el?  I know that you are not particularly in favor of unnecessarily
autoloading variables, so I wonder what the story is here.  Thx.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12583; Package emacs. (Sat, 06 Oct 2012 16:13:01 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 12583 <at> debbugs.gnu.org, 'Le Wang' <l26wang <at> gmail.com>
Subject: Re: bug#12583: latest org-mode changes exposes bug in
	`comment-forward'in newcomment.el
Date: Sat, 06 Oct 2012 12:12:03 -0400
> For my own use, I wonder whether I should be calling `c-n-v' before
> I make use of `comment-search-forward'.

Yes, you should.

> BTW, why are there so many things besided commands that have autoload
> cookies in newcomment.el?  I know that you are not particularly in
> favor of unnecessarily autoloading variables, so I wonder what the
> story is here.  Thx.

The functionality of newcomment.el used to be in simple.el and hence
preloaded.  To make the transition as smooth as possible (there were
already plenty of changes) I autoloaded all the things which used to
be preloaded.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12583; Package emacs. (Sat, 06 Oct 2012 16:39:02 GMT) Full text and rfc822 format available.

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

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Stefan Monnier'" <monnier <at> IRO.UMontreal.CA>
Cc: 12583 <at> debbugs.gnu.org, 'Le Wang' <l26wang <at> gmail.com>
Subject: RE: bug#12583: latest org-mode changes exposes bug in
	`comment-forward'in newcomment.el
Date: Sat, 6 Oct 2012 09:37:48 -0700
> > For my own use, I wonder whether I should be calling `c-n-v' before
> > I make use of `comment-search-forward'.
> 
> Yes, you should.

OK, thanks.  Please consider providing specific guidelines about this,
somewhere.

> > BTW, why are there so many things besided commands that 
> > have autoload cookies in newcomment.el?  I know that you
> > are not particularly in favor of unnecessarily autoloading
> > variables, so I wonder what the story is here.  Thx.
> 
> The functionality of newcomment.el used to be in simple.el and hence
> preloaded.  To make the transition as smooth as possible (there were
> already plenty of changes) I autoloaded all the things which used to
> be preloaded.

OK, so it was only for a transition.  Presumably that means that some of those
autoloads will be removed at some point.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12583; Package emacs. (Sat, 06 Oct 2012 16:50:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 12583 <at> debbugs.gnu.org, 'Le Wang' <l26wang <at> gmail.com>
Subject: Re: bug#12583: latest org-mode changes exposes bug in
	`comment-forward'in newcomment.el
Date: Sat, 06 Oct 2012 12:48:40 -0400
>> > For my own use, I wonder whether I should be calling `c-n-v' before
>> > I make use of `comment-search-forward'.
>> Yes, you should.
> OK, thanks.  Please consider providing specific guidelines about this,
> somewhere.

I think the guideline "commands that use comment-* functions should call
c-n-v first" is a good approximation.

> OK, so it was only for a transition.  Presumably that means that some
> of those autoloads will be removed at some point.

Except that I don't know how to mark obsolete the auto-loading of
a variable, so the transition would be just as abrupt now as it would
have been then.
I guess we can remove autoloads one at a time and see when
someone screams.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12583; Package emacs. (Sat, 06 Oct 2012 16:59:01 GMT) Full text and rfc822 format available.

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

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Stefan Monnier'" <monnier <at> IRO.UMontreal.CA>
Cc: 12583 <at> debbugs.gnu.org, 'Le Wang' <l26wang <at> gmail.com>
Subject: RE: bug#12583: latest org-mode changes exposes bug in
	`comment-forward'in newcomment.el
Date: Sat, 6 Oct 2012 09:57:29 -0700
> > OK, thanks.  Please consider providing specific guidelines 
> > about this, somewhere.
> 
> I think the guideline "commands that use comment-* functions 
> should call c-n-v first" is a good approximation.

Then please put that guideline somewhere.  (Currently, the doc string mentions
only autoloaded functions in newcomment.el.)

IOW, I've gotten the message, but this is not obvious, so please help other
users by pointing this out somewhere.

> > OK, so it was only for a transition.  Presumably that means 
> > that some of those autoloads will be removed at some point.
> 
> Except that I don't know how to mark obsolete the auto-loading of
> a variable, so the transition would be just as abrupt now as it would
> have been then.  I guess we can remove autoloads one at a time
> and see when someone screams.

I see.  Is this what is done whenever something that was formerly preloaded gets
moved to a library that is not preloaded?

To be clear, it doesn't bother me that we autoload something that you might
consider extra.  I'm just pointing this out as an apparent exception - a place
where you might want to take a second look (which you've now done).





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12583; Package emacs. (Sat, 06 Oct 2012 17:08:01 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 12583 <at> debbugs.gnu.org, 'Le Wang' <l26wang <at> gmail.com>
Subject: Re: bug#12583: latest org-mode changes exposes bug in
	`comment-forward'in newcomment.el
Date: Sat, 06 Oct 2012 13:07:33 -0400
> The doc string of `comment-normalize-vars' says, BTW, that it is the
> functions that are autoloaded from newcomment.el that should call
> `c-n-v'.

That's actually a good guideline, yes.

> But you seem to be saying that those are not the only ones.

No.  AFAICT it's basically the same since all the autoloaded functions
of newcomment.el are commands.

> It is also the case that not all functions that are autoloaded from
> newcomment.el call `c-n-v'.

That would be a bug, I think.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12583; Package emacs. (Sat, 06 Oct 2012 17:13:02 GMT) Full text and rfc822 format available.

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

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Stefan Monnier'" <monnier <at> IRO.UMontreal.CA>
Cc: 12583 <at> debbugs.gnu.org, 'Le Wang' <l26wang <at> gmail.com>
Subject: RE: bug#12583: latest org-mode changes exposes bug in
	`comment-forward'in newcomment.el
Date: Sat, 6 Oct 2012 10:12:08 -0700
> > The doc string of `comment-normalize-vars' says, BTW, that it is the
> > functions that are autoloaded from newcomment.el that should call
> > `c-n-v'.
> 
> That's actually a good guideline, yes.

But apparently not sufficient, in terms of helping users with their own uses of
newcomment.el functions.  IOW, it should apparently be about not commands that
use newcomment functions, not just newcomment commands.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12583; Package emacs. (Sun, 07 Oct 2012 00:49:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 12583 <at> debbugs.gnu.org, 'Le Wang' <l26wang <at> gmail.com>
Subject: Re: bug#12583: latest org-mode changes exposes bug in
	`comment-forward'in newcomment.el
Date: Sat, 06 Oct 2012 20:48:33 -0400
> But apparently not sufficient, in terms of helping users with their
> own uses of newcomment.el functions.  IOW, it should apparently be
> about not commands that use newcomment functions, not just
        ^^^
I assume you meant "all" rather than "not", right?  If so, I agree.

> newcomment commands.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12583; Package emacs. (Sun, 07 Oct 2012 02:53:01 GMT) Full text and rfc822 format available.

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

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Stefan Monnier'" <monnier <at> iro.umontreal.ca>
Cc: 12583 <at> debbugs.gnu.org, 'Le Wang' <l26wang <at> gmail.com>
Subject: RE: bug#12583: latest org-mode changes exposes bug in
	`comment-forward'in newcomment.el
Date: Sat, 6 Oct 2012 19:51:43 -0700
> > But apparently not sufficient, in terms of helping users with their
> > own uses of newcomment.el functions.  IOW, it should apparently be
> > about not commands that use newcomment functions, not just
>         ^^^
> I assume you meant "all" rather than "not", right?  If so, I agree.
> 
> > newcomment commands.

Yes (in fact I meant that that first `not' be removed).  Thx.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12583; Package emacs. (Tue, 23 Oct 2012 02:21:02 GMT) Full text and rfc822 format available.

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

From: Chong Yidong <cyd <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 12583 <at> debbugs.gnu.org, Drew Adams <drew.adams <at> oracle.com>,
	'Le Wang' <l26wang <at> gmail.com>
Subject: Re: bug#12583: latest org-mode changes exposes bug in
	`comment-forward'in newcomment.el
Date: Tue, 23 Oct 2012 10:18:19 +0800
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>> But apparently not sufficient, in terms of helping users with their
>> own uses of newcomment.el functions.  IOW, it should apparently be
>> about not commands that use newcomment functions, not just
>         ^^^
> I assume you meant "all" rather than "not", right?  If so, I agree.

I updated the doc of comment-normalize-vars, and the commentary of
newcomment.el, accordingly.




bug closed, send any further explanations to 12583 <at> debbugs.gnu.org and Le Wang <l26wang <at> gmail.com> Request was from Chong Yidong <cyd <at> gnu.org> to control <at> debbugs.gnu.org. (Tue, 23 Oct 2012 02:21:03 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. (Tue, 20 Nov 2012 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 300 days ago.

Previous Next


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