GNU bug report logs - #15580
[PATCH] 24.3.50; subword-capitalize at the end of a buffer jumps to the beginning

Previous Next

Package: emacs;

Reported by: Dima Kogan <dima <at> secretsauce.net>

Date: Thu, 10 Oct 2013 07:02:01 UTC

Severity: normal

Tags: patch

Done: Stefan Monnier <monnier <at> IRO.UMontreal.CA>

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 15580 in the body.
You can then email your comments to 15580 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#15580; Package emacs. (Thu, 10 Oct 2013 07:02:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dima Kogan <dima <at> secretsauce.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 10 Oct 2013 07:02:02 GMT) Full text and rfc822 format available.

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

From: Dima Kogan <dima <at> secretsauce.net>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] 24.3.50;
 subword-capitalize at the end of a buffer jumps to the beginning
Date: Thu, 10 Oct 2013 00:01:22 -0700
[Message part 1 (text/plain, inline)]
Hi.

I'm observing subword-capitalize get confused when called near the end
of a buffer. Instead of doing nothing like capitalize-word does,
subword-capitalize jumps to around the beginning of the buffer and
capitalizes something there.

The cause is simple. subword-capitalize does

(re-search-forward "[[:alpha:]]" ....)

and uses the results of this search even if it failed. The attached
patch explicitly checks for search failure and exits the function in
that case.

[0001-subword-capitalize-now-fails-gracefully-at-end-of-bu.patch (text/x-diff, attachment)]

Reply sent to Stefan Monnier <monnier <at> IRO.UMontreal.CA>:
You have taken responsibility. (Tue, 15 Oct 2013 12:35:03 GMT) Full text and rfc822 format available.

Notification sent to Dima Kogan <dima <at> secretsauce.net>:
bug acknowledged by developer. (Tue, 15 Oct 2013 12:35:04 GMT) Full text and rfc822 format available.

Message #10 received at 15580-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Dima Kogan <dima <at> secretsauce.net>
Cc: 15580-done <at> debbugs.gnu.org
Subject: Re: bug#15580: [PATCH] 24.3.50;
 subword-capitalize at the end of a buffer jumps to the beginning
Date: Mon, 14 Oct 2013 15:25:17 -0400
> and uses the results of this search even if it failed. The attached
> patch explicitly checks for search failure and exits the function in
> that case.

Thanks.  I slightly simplified your patch (since re-search-forward
already signal search-failed if the 3rd arg is nil) and installed it.


        Stefan


PS: This is at least the second "tiny" patch you contributed, so you're
on course to hit the limit of what we can accept without
copyright paperwork.  If you'd like to sign this paperwork already to
avoid future delays, I can send you the needed forms.




Did not alter fixed versions and reopened. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 15 Oct 2013 19:00:04 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15580; Package emacs. (Tue, 15 Oct 2013 19:05:04 GMT) Full text and rfc822 format available.

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

From: Dima Kogan <dima <at> secretsauce.net>
To: 15580 <at> debbugs.gnu.org
Subject: Re: bug#15580: [PATCH] 24.3.50;
 subword-capitalize at the end of a buffer jumps to the beginning
Date: Tue, 15 Oct 2013 12:03:58 -0700
[Message part 1 (text/plain, inline)]
Stefan Monnier <monnier <at> IRO.UMontreal.CA> writes:

> Thanks.  I slightly simplified your patch (since re-search-forward
> already signal search-failed if the 3rd arg is nil) and installed it.

Hi.

Thanks for looking at this. I tried the fix you made in the repo, and it
has two issues:

1. search-failed is raised with (signal) not (throw), so it needs to be
   caught differently

2. You changed (re-search-forward) to (search-forward), however we still
   are searching for a regex, so it must remain re-search-forward.

I'm attaching a patch to fix these two issues

dima

[0001-Correction-to-the-recent-subword-capitalize-fix.patch (text/x-diff, attachment)]

Reply sent to Stefan Monnier <monnier <at> IRO.UMontreal.CA>:
You have taken responsibility. (Wed, 16 Oct 2013 03:04:02 GMT) Full text and rfc822 format available.

Notification sent to Dima Kogan <dima <at> secretsauce.net>:
bug acknowledged by developer. (Wed, 16 Oct 2013 03:04:03 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Dima Kogan <dima <at> secretsauce.net>
Cc: 15580-done <at> debbugs.gnu.org
Subject: Re: bug#15580: [PATCH] 24.3.50;
 subword-capitalize at the end of a buffer jumps to the beginning
Date: Tue, 15 Oct 2013 23:03:11 -0400
> Thanks for looking at this. I tried the fix you made in the repo, and it
> has two issues:

Duh!

> I'm attaching a patch to fix these two issues

Thank you very much.  Installed as-is for fear of messing up again,


        Stefan




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 13 Nov 2013 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 279 days ago.

Previous Next


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