all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dima Kogan <dima@secretsauce.net>
To: 15580@debbugs.gnu.org
Subject: 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	[thread overview]
Message-ID: <87y55u2w69.fsf@secretsauce.net> (raw)
In-Reply-To: <jwvvc0zodzt.fsf-monnier+emacsbugs@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 577 bytes --]

Stefan Monnier <monnier@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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Correction-to-the-recent-subword-capitalize-fix.patch --]
[-- Type: text/x-diff, Size: 1500 bytes --]

From b3d45ce893aa51f9fd7175a70003dca5571be9d2 Mon Sep 17 00:00:00 2001
From: Dima Kogan <dima@secretsauce.net>
Date: Tue, 15 Oct 2013 11:54:56 -0700
Subject: [PATCH] Correction to the recent subword-capitalize fix

This applies to emacs bug 15580
---
 lisp/progmodes/subword.el | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lisp/progmodes/subword.el b/lisp/progmodes/subword.el
index 1232588..0d754d5 100644
--- a/lisp/progmodes/subword.el
+++ b/lisp/progmodes/subword.el
@@ -257,7 +257,7 @@ Optional argument ARG is the same as for `upcase-word'."
 See the command `subword-mode' for a description of subwords.
 Optional argument ARG is the same as for `capitalize-word'."
   (interactive "p")
-  (catch 'search-failed
+  (condition-case nil
     (let ((count (abs arg))
           (start (point))
           (advance (>= arg 0)))
@@ -265,7 +265,7 @@ Optional argument ARG is the same as for `capitalize-word'."
       (dotimes (i count)
         (if advance
             (progn
-              (search-forward "[[:alpha:]]")
+              (re-search-forward "[[:alpha:]]")
               (goto-char (match-beginning 0)))
           (subword-backward))
         (let* ((p (point))
@@ -275,7 +275,8 @@ Optional argument ARG is the same as for `capitalize-word'."
           (downcase-region pp np)
           (goto-char (if advance np p))))
       (unless advance
-        (goto-char start)))))
+        (goto-char start)))
+    (search-failed nil)))
 
 \f
 
-- 
1.8.3.2


  reply	other threads:[~2013-10-15 19:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-10  7:01 bug#15580: [PATCH] 24.3.50; subword-capitalize at the end of a buffer jumps to the beginning Dima Kogan
2013-10-14 19:25 ` Stefan Monnier
2013-10-15 19:03   ` Dima Kogan [this message]
2013-10-16  3:03     ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y55u2w69.fsf@secretsauce.net \
    --to=dima@secretsauce.net \
    --cc=15580@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.