From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 19 05:23:17 2013 Received: (at submit) by debbugs.gnu.org; 19 Feb 2013 10:23:17 +0000 Received: from localhost ([127.0.0.1]:36044 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U7kM1-0004i9-78 for submit@debbugs.gnu.org; Tue, 19 Feb 2013 05:23:17 -0500 Received: from eggs.gnu.org ([208.118.235.92]:53479) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U7kLy-0004i2-KJ for submit@debbugs.gnu.org; Tue, 19 Feb 2013 05:23:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U7kKm-0003hO-OS for submit@debbugs.gnu.org; Tue, 19 Feb 2013 05:22:10 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:44507) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U7kKm-0003hJ-Kv for submit@debbugs.gnu.org; Tue, 19 Feb 2013 05:22:00 -0500 Received: from eggs.gnu.org ([208.118.235.92]:36537) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U7kKj-0000o9-DC for bug-gnu-emacs@gnu.org; Tue, 19 Feb 2013 05:22:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U7kKg-0003fo-5S for bug-gnu-emacs@gnu.org; Tue, 19 Feb 2013 05:21:57 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:42616) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U7kKg-0003fU-1H for bug-gnu-emacs@gnu.org; Tue, 19 Feb 2013 05:21:54 -0500 Received: from compute3.internal (compute3.nyi.mail.srv.osa [10.202.2.43]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id F27DE20904 for ; Tue, 19 Feb 2013 05:21:51 -0500 (EST) Received: from frontend2.nyi.mail.srv.osa ([10.202.2.161]) by compute3.internal (MEProxy); Tue, 19 Feb 2013 05:21:51 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=secretsauce.net; h=from:to:subject:date:message-id:mime-version:content-type; s= mesmtp; bh=grHZzM89coKYMLYNZ22sQN7vfJQ=; b=PvlQYZfVMUH5uxNxlmTIy bMKiNhOGgRR2o28eT8Vx6/7Sn8FJaLNQrsk50wNYztkVCmh9dahFcuRIB5HeG2hi j1QfHL/RSGnApLMQb2lB2mFpIl31cQlpkkytX/rL03nJFeU+Bpx53Z8KKp8s+LzP aaS7JkEwXo42KBBtd24wSc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=from:to:subject:date:message-id :mime-version:content-type; s=smtpout; bh=grHZzM89coKYMLYNZ22sQN 7vfJQ=; b=d9Gs6ZH4dCc6aiM2JknM8XvPtm9iahwWklUUbkZxcX6gpMvCRvUbVF 3htijMXsCzZrPDphbD2YlSKKPivFuxs57Id6GnMGJy6jkWSoVaea70rOaoC/zwiF tR5cN2kluApud9hfHkLBVkh4ZC8FYZkt4RXLtDG/tePaLJV7wUsnQ= X-Sasl-enc: r5IZt/nLpDJgQCCSLqKco8b1NxYnuL2xgUGNsF3+zm6k 1361269311 Received: from shorty.local (unknown [76.169.247.77]) by mail.messagingengine.com (Postfix) with ESMTPA id A3EE1482775 for ; Tue, 19 Feb 2013 05:21:51 -0500 (EST) Received: from dima by shorty.local with local (Exim 4.80) (envelope-from ) id 1U7kKc-0003GX-4h for bug-gnu-emacs@gnu.org; Tue, 19 Feb 2013 02:21:50 -0800 From: Dima Kogan To: bug-gnu-emacs@gnu.org Subject: 24.3.50; [PATCH] fixed (subword-forward) edge case at the end of a buffer Date: Tue, 19 Feb 2013 02:21:49 -0800 Message-ID: <8738wspps2.fsf@secretsauce.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.0 (-----) --=-=-= Content-Type: text/plain I'm attaching a patch to fix an edge case of (subword-forward). To reproduce the issue: 1. create a buffer that has an all-caps string such as 'ASDF' at the end of the buffer. There must not be a newline at the end; the 'F' should be the last character 2. Go to the start of the buffer, and do (subword-forward). Observe that the point ends up at the 'F', but it should end up one character ahead of there. To see more clearly that this is wrong, do (subword-downcase 1) instead of (subword-forward). This should make all the characters lowercase, but it misses the last one. This is happening because (subword-forward) is trying to match the character after the start of the new subword, but at the end of the buffer, this character doesn't exist. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-subword-forward-no-longer-gets-confused-by-the-end-o.patch Content-Description: patch >From c248e56c86d96dac8990880b44b983fd4883b1d9 Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Tue, 19 Feb 2013 02:14:26 -0800 Subject: [PATCH] (subword-forward) no longer gets confused by the end of the buffer This fixes an edge case of (subword-forward). If the point is at the start of an all-caps word at the end of the buffer, (subword-forward) would end up at the last character of the word, NOT past the word, as it should. This was happening because (subword-forward) was trying to match the character after the start of the new subword, but at the end of the buffer, this character didn't exist --- lisp/progmodes/subword.el | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lisp/progmodes/subword.el b/lisp/progmodes/subword.el index 80e632c..a86a29b 100644 --- a/lisp/progmodes/subword.el +++ b/lisp/progmodes/subword.el @@ -87,7 +87,7 @@ "Function to call for backward subword movement.") (defvar subword-forward-regexp - "\\W*\\(\\([[:upper:]]*\\W?\\)[[:lower:][:digit:]]*\\)" + "\\W*\\(\\([[:upper:]]*\\(\\W?\\)\\)[[:lower:][:digit:]]*\\)" "Regexp used by `subword-forward-internal'.") (defvar subword-backward-regexp @@ -268,7 +268,16 @@ Optional argument ARG is the same as for `capitalize-word'." (goto-char (cond ((< 1 (- (match-end 2) (match-beginning 2))) - (1- (match-end 2))) + ;; if we saw start of subword (capital letters or + ;; whitespace)... + (if (and (= (match-end 2) (point-max)) + (= (match-end 2) (match-beginning 3))) + ;; ... and we have all-caps at the end of the buffer, the + ;; next subword starts at end of buffer... + (match-end 2) + ;; ... if we're not at the end, we have the position of the + ;; 2nd character in the subword, so go back one + (1- (match-end 2)))) (t (match-end 0)))) (forward-word 1))) -- 1.7.10.4 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 17 17:02:57 2013 Received: (at 13758) by debbugs.gnu.org; 17 Jul 2013 21:02:57 +0000 Received: from localhost ([127.0.0.1]:33569 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UzYsC-0004ho-2n for submit@debbugs.gnu.org; Wed, 17 Jul 2013 17:02:56 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:37028) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UzYs9-0004hc-Ii for 13758@debbugs.gnu.org; Wed, 17 Jul 2013 17:02:54 -0400 Received: from compute1.internal (compute1.nyi.mail.srv.osa [10.202.2.41]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id 1020721220 for <13758@debbugs.gnu.org>; Wed, 17 Jul 2013 17:02:53 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute1.internal (MEProxy); Wed, 17 Jul 2013 17:02:53 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=secretsauce.net; h=from:to:subject:date:message-id:mime-version:content-type; s= mesmtp; bh=Fh2LUgwrzDaA+HdGIxucbCGNeYo=; b=X9Goez6tIfSYz0abo4U7X nRSRXCBz1hlmYi0w9fYjNojuqX0Eyta/woItQFu1YVA6Mqb+sDRWXkQJL2fVz1oY 1CKOHQn0yQR4RVsXHXF45ZSFa+yZ10+HqBBV9dJisO0aJ1ex3PWrSWpsQOak7j3R FAv8Jh0gVEWvbbtcNlcew4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=from:to:subject:date:message-id :mime-version:content-type; s=smtpout; bh=Fh2LUgwrzDaA+HdGIxucbC GNeYo=; b=mXKdu+qvJrhxuHGfG+j0d943ejWlnQOdqet60g5KQ8+gjLFzVhGVKZ w6bxAINOMyLbbCF1BaOdwM9PqEDqLxdN4A+BOLM5ZXwsZ2GivRL6m3Sofh2sdB3M 8+npcoQZmUJ/hwp6xD4VYEUTLYWWpgDXLYf04nl8vcb0+K2wKX0gM= X-Sasl-enc: BaF1neIXWJcRY2e38lddgrVB+B7YZP7D+NbjnbfwkKU2 1374094972 Received: from shorty.local (unknown [76.169.247.77]) by mail.messagingengine.com (Postfix) with ESMTPA id CF37B680092 for <13758@debbugs.gnu.org>; Wed, 17 Jul 2013 17:02:52 -0400 (EDT) Received: from dima by shorty.local with local (Exim 4.80) (envelope-from ) id 1UzYs7-0000NB-FV for 13758@debbugs.gnu.org; Wed, 17 Jul 2013 14:02:51 -0700 From: Dima Kogan To: 13758@debbugs.gnu.org Subject: Note User-agent: mu4e 0.9.9.5; emacs 24.3.1 Date: Wed, 17 Jul 2013 14:02:51 -0700 Message-ID: <87r4ew5284.fsf@secretsauce.net> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 13758 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Now that I'm aware of this bug, I run into it all the time in everyday use of emacs. It is very common for me to hit this in the minibuffer, where short snippets without a trailing newline are common. From debbugs-submit-bounces@debbugs.gnu.org Mon Jul 22 12:26:27 2013 Received: (at 13758-done) by debbugs.gnu.org; 22 Jul 2013 16:26:27 +0000 Received: from localhost ([127.0.0.1]:42960 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1V1IwM-0003ja-C2 for submit@debbugs.gnu.org; Mon, 22 Jul 2013 12:26:26 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:57066) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1V1IwJ-0003j8-Hd for 13758-done@debbugs.gnu.org; Mon, 22 Jul 2013 12:26:23 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av8EABK/CFG4rw7r/2dsb2JhbABEuzWDWRdzgh4BAQQBViMFCws0EhQYDSSIHgbBLZEKA6R6gV6DEw X-IPAS-Result: Av8EABK/CFG4rw7r/2dsb2JhbABEuzWDWRdzgh4BAQQBViMFCws0EhQYDSSIHgbBLZEKA6R6gV6DEw X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="19531951" Received: from 184-175-14-235.dsl.teksavvy.com (HELO pastel.home) ([184.175.14.235]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 22 Jul 2013 12:26:11 -0400 Received: by pastel.home (Postfix, from userid 20848) id 257076D694; Mon, 22 Jul 2013 12:26:17 -0400 (EDT) From: Stefan Monnier To: Dima Kogan Subject: Re: bug#13758: 24.3.50; [PATCH] fixed (subword-forward) edge case at the end of a buffer Message-ID: References: <8738wspps2.fsf@secretsauce.net> Date: Mon, 22 Jul 2013 12:26:17 -0400 In-Reply-To: <8738wspps2.fsf@secretsauce.net> (Dima Kogan's message of "Tue, 19 Feb 2013 02:21:49 -0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 13758-done Cc: 13758-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) > I'm attaching a patch to fix an edge case of (subword-forward). To > reproduce the issue: Thank you. I installed a slightly different patch, but it does fundamentally the same. Should be fixed now, Stefan From unknown Tue Aug 19 02:59:15 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 20 Aug 2013 11:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator