From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 29 09:28:21 2013 Received: (at submit) by debbugs.gnu.org; 29 Apr 2013 13:28:21 +0000 Received: from localhost ([127.0.0.1]:49883 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UWo7v-0004MQ-Jj for submit@debbugs.gnu.org; Mon, 29 Apr 2013 09:28:20 -0400 Received: from eggs.gnu.org ([208.118.235.92]:40467) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UWo7r-0004M6-Jw for submit@debbugs.gnu.org; Mon, 29 Apr 2013 09:28:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UWo7V-0006xo-Ht for submit@debbugs.gnu.org; Mon, 29 Apr 2013 09:27:54 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-101.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID,USER_IN_WHITELIST autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:48777) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UWo7V-0006xh-9p for submit@debbugs.gnu.org; Mon, 29 Apr 2013 09:27:53 -0400 Received: from eggs.gnu.org ([208.118.235.92]:51804) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UWo7P-0003de-KK for bug-gnu-emacs@gnu.org; Mon, 29 Apr 2013 09:27:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UWo7N-0006vo-0b for bug-gnu-emacs@gnu.org; Mon, 29 Apr 2013 09:27:47 -0400 Received: from mail-pb0-x231.google.com ([2607:f8b0:400e:c01::231]:60686) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UWo7M-0006vZ-Qb for bug-gnu-emacs@gnu.org; Mon, 29 Apr 2013 09:27:44 -0400 Received: by mail-pb0-f49.google.com with SMTP id rp8so655096pbb.36 for ; Mon, 29 Apr 2013 06:27:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:subject:x-debbugs-cc:date:message-id :mime-version:content-type; bh=akyAlzp5cZ8vnAzuwWH8g8vevEKMyvxiRnAWOrqxYdg=; b=bqb78KZ44+8zB29j0gExMkSsTrPlAqRZvtgSwI88qN1yySw4EhUxkqyexWm/yMiC08 QPpzilgO0EyXsanW+2K2wBvmrPOynSfbiokB8ecgF7Np6NHdttYUXyQlJbsdbOjyk6E2 tG4taDlrrobaAxqikhaTQsWwdRyzMwxWY9sCwfiIy+gQXrOcVFumsW3u47gi63NA0o/g 978AfoIaMHvVXatOOP9DIF8lCF7VJhgSt/C9DyUllrQrqO4UhUz+d4HGJS5VBWzfmmjA RP+yhS32ls+yj2ZN9+Hj6uYFY6dB2AZ7Jpiw+BFOt3WniQeF1uDoiP9wpgjC573mKGWf dVBw== X-Received: by 10.68.212.195 with SMTP id nm3mr22032837pbc.80.1367242064064; Mon, 29 Apr 2013 06:27:44 -0700 (PDT) Received: from localhost ([110.172.225.137]) by mx.google.com with ESMTPSA id br2sm24050468pbc.46.2013.04.29.06.27.41 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 29 Apr 2013 06:27:43 -0700 (PDT) From: Leo Liu To: bug-gnu-emacs@gnu.org Subject: 24.3; Bug in comment-search-backward X-Debbugs-CC: Stefan Monnier Date: Mon, 29 Apr 2013 21:27:35 +0800 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -4.7 (----) 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: -6.1 (------) Open a new buffer in octave-mode and insert the following line: x="#abc" Move point to the end of the inserted line and M-: (comment-search-backward) this moves point inside the string. Due to this bug octave-mode users are seeing mysterious comment char such as % or # inserted by fill-paragraph or auto-fill-mode. Leo From debbugs-submit-bounces@debbugs.gnu.org Wed May 15 07:34:00 2013 Received: (at 14303) by debbugs.gnu.org; 15 May 2013 11:34:00 +0000 Received: from localhost ([127.0.0.1]:45425 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UcZy3-00076g-Fo for submit@debbugs.gnu.org; Wed, 15 May 2013 07:33:59 -0400 Received: from mail-pa0-f54.google.com ([209.85.220.54]:50807) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UcZy1-00076L-0B for 14303@debbugs.gnu.org; Wed, 15 May 2013 07:33:58 -0400 Received: by mail-pa0-f54.google.com with SMTP id kx1so1417485pab.41 for <14303@debbugs.gnu.org>; Wed, 15 May 2013 04:33:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:in-reply-to:references:user-agent :face:date:message-id:mime-version:content-type; bh=5EuVG8fCJjJXbshF72HfLEjynGl3y3X3APu2/LJb9SI=; b=D0r/sejCFjVzC2vpJK8M619JtsfGBM70IaY8QxmG4FdqLEI9usPT7k4Ql/tzruD2UU v5ksfocmOTtDGYy3jta3DSSupvyJrCArz7yJjjyjOYUJa8nPN3JbLoY3P1/xnq3i09eo c3z1gLWiCsENM8NeQnBod+idLTKv18EJHoOO8QueUkFC++LNCm6WNbWXnXC4nW00qrVh TIep+xZrmRbBJbL/swqGGFR+yt/q8uWdl4v7TfvGb5+jOmDiene2uKseTMyRpBF03NKr g7+9cOthkcXCA7dbj1nYAyzTaZieqhEAYCLCadioI0Xmhjz6mvU62WNjMS8oI3s1i8rj dXBw== X-Received: by 10.68.226.106 with SMTP id rr10mr37996607pbc.127.1368617626653; Wed, 15 May 2013 04:33:46 -0700 (PDT) Received: from Zeuss-MacBook.local ([119.161.133.157]) by mx.google.com with ESMTPSA id xu10sm3071379pab.3.2013.05.15.04.33.41 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 15 May 2013 04:33:46 -0700 (PDT) From: Leo Liu To: 14303@debbugs.gnu.org Subject: Re: bug#14303: 24.3; Bug in comment-search-backward In-Reply-To: (Leo Liu's message of "Mon, 29 Apr 2013 21:27:35 +0800") References: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (OS X 10.8.3) Face: iVBORw0KGgoAAAANSUhEUgAAACgAAAAoBAMAAAB+0KVeAAAAG1BMVEUAAAA9Cgm3Hx1WWFWA gn+WmJWsrqv4+vcCAwCRl2MkAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAAYoA AAGKATOXMFgAAAAHdElNRQfXAQwDNR+ZJmElAAABIklEQVQoz22SPW+DQAyGWUq65qasd9PNUSX4 AZHK2C1rJy5jpDS4IwRVup9dn7GNafpKIPPgzztXFSujqq1eM2n8h22oMkvxI/i9C97kRfMRUN55 dS3BrsAwBXUtMLAO4lryh8kTjOxKpQNniNxAgZOEe4bZwsDTFhKdqZRLNII4OQNHhEuq/RMkm6Cj TnnEA/fk0BorcYn5qA3oaeAxbaBOLrX+9G48NZ2Fzc2tzDM8Q+tMypEOqYHh8mAWaaK3U/cDMOT5 aMZMABgPXc7zPMs1A8DXO756GFJ/4fMEq47hTsAdn5avoxZ4ywl0c2w4Flu2Ybeyb3S+EqxX2DYA H8veJGEDTnHnrXvRaPyt+2kSfK6rfBZ2tUtfP/mR+pR6sX8BUZ/cDV7tvkoAAAAASUVORK5CYII= Date: Wed, 15 May 2013 19:33:23 +0800 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 14303 Cc: Stefan Monnier 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: -2.6 (--) On 2013-04-29 21:27 +0800, Leo Liu wrote: > Open a new buffer in octave-mode and insert the following line: > > x="#abc" > > Move point to the end of the inserted line and > > M-: (comment-search-backward) > > this moves point inside the string. So it is no longer fine for comment-search-backward to end up in a comment or string any more. How about something like this? diff --git a/lisp/newcomment.el b/lisp/newcomment.el index d55feaa3..65182c1b 100644 --- a/lisp/newcomment.el +++ b/lisp/newcomment.el @@ -485,27 +485,25 @@ (defun comment-search-backward (&optional limit noerror) Moves point to inside the comment and returns the position of the comment-starter. If no comment is found, moves point to LIMIT and raises an error or returns nil if NOERROR is non-nil." - ;; FIXME: If a comment-start appears inside a comment, we may erroneously - ;; stop there. This can be rather bad in general, but since - ;; comment-search-backward is only used to find the comment-column (in - ;; comment-set-column) and to find the comment-start string (via - ;; comment-beginning) in indent-new-comment-line, it should be harmless. - (if (not (re-search-backward comment-start-skip limit t)) - (unless noerror (error "No comment")) - (beginning-of-line) - (let* ((end (match-end 0)) - (cs (comment-search-forward end t)) - (pt (point))) - (if (not cs) - (progn (beginning-of-line) - (comment-search-backward limit noerror)) - (while (progn (goto-char cs) - (comment-forward) - (and (< (point) end) - (setq cs (comment-search-forward end t)))) - (setq pt (point))) - (goto-char pt) - cs)))) + (let (found end) + (while (and (not found) (re-search-backward comment-start-skip limit t)) + (setq end (match-end 0)) + (or (nth 8 (syntax-ppss)) (setq found t))) + (if (not found) + (unless noerror (error "No comment")) + (beginning-of-line) + (let ((cs (comment-search-forward end t)) + (pt (point))) + (if (not cs) + (progn (beginning-of-line) + (comment-search-backward limit noerror)) + (while (progn (goto-char cs) + (comment-forward) + (and (< (point) end) + (setq cs (comment-search-forward end t)))) + (setq pt (point))) + (goto-char pt) + cs))))) (defun comment-beginning () "Find the beginning of the enclosing comment. From debbugs-submit-bounces@debbugs.gnu.org Wed May 15 12:11:53 2013 Received: (at submit) by debbugs.gnu.org; 15 May 2013 16:11:53 +0000 Received: from localhost ([127.0.0.1]:46182 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UceIy-00017S-F2 for submit@debbugs.gnu.org; Wed, 15 May 2013 12:11:53 -0400 Received: from eggs.gnu.org ([208.118.235.92]:41282) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UceIv-00017E-8C for submit@debbugs.gnu.org; Wed, 15 May 2013 12:11:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UceIf-0007qW-Kv for submit@debbugs.gnu.org; Wed, 15 May 2013 12:11:38 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-100.0 required=5.0 tests=BAYES_20, RCVD_IN_DNSWL_NONE, USER_IN_WHITELIST autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:36001) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UceIf-0007qQ-HZ for submit@debbugs.gnu.org; Wed, 15 May 2013 12:11:33 -0400 Received: from eggs.gnu.org ([208.118.235.92]:52575) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UceIa-0003WY-Mv for bug-gnu-emacs@gnu.org; Wed, 15 May 2013 12:11:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UceIU-0007oL-VJ for bug-gnu-emacs@gnu.org; Wed, 15 May 2013 12:11:28 -0400 Received: from moutng.kundenserver.de ([212.227.126.171]:58118) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UceIU-0007nz-Mc for bug-gnu-emacs@gnu.org; Wed, 15 May 2013 12:11:22 -0400 Received: from [192.168.178.21] (brln-4db9f307.pool.mediaWays.net [77.185.243.7]) by mrelayeu.kundenserver.de (node=mreu4) with ESMTP (Nemesis) id 0Mbo1J-1Uv93N0rcz-00J4eo; Wed, 15 May 2013 18:11:20 +0200 Message-ID: <5193B43B.8070007@easy-emacs.de> Date: Wed, 15 May 2013 18:13:47 +0200 From: =?ISO-8859-15?Q?Andreas_R=F6hler?= User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: bug-gnu-emacs@gnu.org Subject: Re: bug#14303: 24.3; Bug in comment-search-backward References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:eDOCsN2reG5FiZ9mhl66tJdCqejkY/KABDj/J8gMzuH HZ0SRgyrKy1swbWnBBSl1eObPkEOVdRnNV6Y3WDSu1aoUJVr/r oeYhbdZ3UN0jKGky/obFfG2fNfo9MSTkdpWMFgUbcnadGextpF qLAXKzANjTuMaYP/3YVB4L990d3+Gb/ffVIPh+k0peqxcmxvya ibAzPRVjQ3ab0rhNWfsz5977VzdfWcdk1wp7O1UIMUxulPqX/s kjlmQiV9APQJkvd1C27Sa7Axgzy0LTfPa0ZjrFFYnr+8vEei4v 0diZXQb4/w1fS8vlvKcff7yeMkNgQsObnnUrVw4h5iQ4CM2dvP jgAyN//feHNNDIcPmR9nfALfXetrpbUJwmXizRl8t X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -6.9 (------) 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: -6.9 (------) Am 15.05.2013 13:33, schrieb Leo Liu: > On 2013-04-29 21:27 +0800, Leo Liu wrote: >> Open a new buffer in octave-mode and insert the following line: >> >> x="#abc" >> >> Move point to the end of the inserted line and >> >> M-: (comment-search-backward) >> >> this moves point inside the string. > > So it is no longer fine for comment-search-backward to end up in a > comment or string any more. > > How about something like this? > > diff --git a/lisp/newcomment.el b/lisp/newcomment.el > index d55feaa3..65182c1b 100644 > --- a/lisp/newcomment.el > +++ b/lisp/newcomment.el > @@ -485,27 +485,25 @@ (defun comment-search-backward (&optional limit noerror) > Moves point to inside the comment and returns the position of the > comment-starter. If no comment is found, moves point to LIMIT > and raises an error or returns nil if NOERROR is non-nil." > - ;; FIXME: If a comment-start appears inside a comment, we may erroneously > - ;; stop there. This can be rather bad in general, but since > - ;; comment-search-backward is only used to find the comment-column (in > - ;; comment-set-column) and to find the comment-start string (via > - ;; comment-beginning) in indent-new-comment-line, it should be harmless. > - (if (not (re-search-backward comment-start-skip limit t)) > - (unless noerror (error "No comment")) > - (beginning-of-line) > - (let* ((end (match-end 0)) > - (cs (comment-search-forward end t)) > - (pt (point))) > - (if (not cs) > - (progn (beginning-of-line) > - (comment-search-backward limit noerror)) > - (while (progn (goto-char cs) > - (comment-forward) > - (and (< (point) end) > - (setq cs (comment-search-forward end t)))) > - (setq pt (point))) > - (goto-char pt) > - cs)))) > + (let (found end) > + (while (and (not found) (re-search-backward comment-start-skip limit t)) > + (setq end (match-end 0)) > + (or (nth 8 (syntax-ppss)) (setq found t))) > + (if (not found) > + (unless noerror (error "No comment")) > + (beginning-of-line) > + (let ((cs (comment-search-forward end t)) > + (pt (point))) > + (if (not cs) > + (progn (beginning-of-line) > + (comment-search-backward limit noerror)) > + (while (progn (goto-char cs) > + (comment-forward) > + (and (< (point) end) > + (setq cs (comment-search-forward end t)))) > + (setq pt (point))) > + (goto-char pt) > + cs))))) > > (defun comment-beginning () > "Find the beginning of the enclosing comment. > > > > syntax-ppss is reliable, while re-search-backward comment-start-skip might stop inside a string etc. backward-line, end-of-line if nt4 and nth8, goto char nth8 that's nearly all as done consider limit of search, sure. Watching with interest, Andreas From debbugs-submit-bounces@debbugs.gnu.org Thu May 16 00:02:41 2013 Received: (at 14303) by debbugs.gnu.org; 16 May 2013 04:02:41 +0000 Received: from localhost ([127.0.0.1]:46802 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UcpOq-0006o3-Lt for submit@debbugs.gnu.org; Thu, 16 May 2013 00:02:41 -0400 Received: from mail-pb0-f47.google.com ([209.85.160.47]:56024) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UcpOp-0006nX-Az for 14303@debbugs.gnu.org; Thu, 16 May 2013 00:02:39 -0400 Received: by mail-pb0-f47.google.com with SMTP id rr4so1928088pbb.6 for <14303@debbugs.gnu.org>; Wed, 15 May 2013 21:02:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:references:face:date:in-reply-to :message-id:user-agent:mime-version:content-type :content-transfer-encoding; bh=tywzzAzQ3RtCwLTegigjPlHWDi4PF+mEV7XjrjrjOpw=; b=SsfxGDAYfdMiYEIW+c1GcLxmUTTcVlNhOSK83wRKdh66lW+nipXQTmkajAJx38ZXYh E0f1nwunZaJx4w9Lr9B4z7CIn0dJNtuTXGCk9ZCLC7ldIE8PGS4o93dBh1r/z8KYCvQy VJMgWCq2Db4qq56MAFviL06aozjAFyzGEUH36zGSAT6vN87Mg1pswOnF03VLcei5deft HQoqkU5DL52cp8TFI1L6vwqQ62IFSPNUS9RYDfL/J6F0AykXQfPNYhVqOnOgVFOodHQ4 bCZglkl1FpkKJNP4zN8/6Vw0y8zZ8J44tIpzg/7Y0bCTCtDqF7CNxDBoUR8C6m7F4ggc o1iQ== X-Received: by 10.66.163.200 with SMTP id yk8mr41896016pab.170.1368676945302; Wed, 15 May 2013 21:02:25 -0700 (PDT) Received: from Zeuss-MacBook.local (li511-224.members.linode.com. [66.175.216.224]) by mx.google.com with ESMTPSA id uq10sm5119285pbc.5.2013.05.15.21.02.22 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 15 May 2013 21:02:24 -0700 (PDT) From: Leo Liu To: Andreas =?iso-8859-1?Q?R=F6hler?= Subject: Re: bug#14303: 24.3; Bug in comment-search-backward References: <5193B43B.8070007@easy-emacs.de> Face: iVBORw0KGgoAAAANSUhEUgAAACkAAAApAQAAAACAGz1bAAABKElEQVQYlWNg3NIt5FDPUPt7 4+X79Qyucz5/ugik+L2PBgKpyphaIK921q23QDnG0NBQoMr/vaWl9f8ZLL78uPv5PwN7RETfzXoG jhmFz27XM0RXmpuY/WfY+fv0Mc56BvFybfXA/wwL5t/wF61n2PU59axXPcOVzbmSW/8zrNt1benC /ww70hqUU/4zKCtrT9jwn8FhwynbufUMendE2aLqGRpdX9al1zM8eh17lKeeQcTMrdD5P8P3j/YT Q/8zXHSb7p1Qz/C4OM2JuZ7hgtI7K6AjqsMnf8j4z8C6xG1tw3+GqpqvsVn/GTzmpD9j/8/wP/oZ S/l/Bka+QO/g/wy15ueeFQL9N1O8mPU/g+umV3t1gdT0/1bTgHLqYVeXAlWKpMWt+w8Az82C9nHf X0cAAAAASUVORK5CYII= Date: Thu, 16 May 2013 12:02:16 +0800 In-Reply-To: <5193B43B.8070007@easy-emacs.de> ("Andreas \=\?iso-8859-1\?Q\?R\?\= \=\?iso-8859-1\?Q\?\=F6hler\=22's\?\= message of "Wed, 15 May 2013 18:13:47 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (OS X 10.8.3) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 14303 Cc: 14303@debbugs.gnu.org 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: -2.6 (--) On 2013-05-16 00:13 +0800, Andreas R=F6hler wrote: > syntax-ppss is reliable, while re-search-backward comment-start-skip > might stop inside a string etc. > > backward-line, end-of-line > if nt4 and nth8, goto char nth8 > > that's nearly all > as done consider limit of search, sure. > > Watching with interest, > > Andreas I don't know what to make of this comment. Do you see a problem in the patch? Thanks, Leo From debbugs-submit-bounces@debbugs.gnu.org Thu May 16 03:10:17 2013 Received: (at 14303) by debbugs.gnu.org; 16 May 2013 07:10:17 +0000 Received: from localhost ([127.0.0.1]:46946 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UcsKN-0005Tr-Pn for submit@debbugs.gnu.org; Thu, 16 May 2013 03:10:16 -0400 Received: from moutng.kundenserver.de ([212.227.17.8]:61049) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UcsKJ-0005TX-Ko for 14303@debbugs.gnu.org; Thu, 16 May 2013 03:10:13 -0400 Received: from [192.168.178.21] (brln-4db9d5fe.pool.mediaWays.net [77.185.213.254]) by mrelayeu.kundenserver.de (node=mrbap1) with ESMTP (Nemesis) id 0Lpxfr-1TysTc3ijP-00fcc6; Thu, 16 May 2013 09:09:56 +0200 Message-ID: <519486DD.1040505@easy-emacs.de> Date: Thu, 16 May 2013 09:12:29 +0200 From: =?ISO-8859-1?Q?Andreas_R=F6hler?= User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: Leo Liu Subject: Re: bug#14303: 24.3; Bug in comment-search-backward References: <5193B43B.8070007@easy-emacs.de> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Provags-ID: V02:K0:S6xwFQofpbI5QWMAOScWN7blYarah0Y8K05ZqWeCRog sKZKB/hmSQ8/YLCJ0Msr/3KoyCYEqYXkSN5BkCDIWealQJlOyW FtRmRpIM2r6nc+znQJ1Ohu8+tUejMrj+ugo2iq6J6KL1mX9/nH zZHnbXQjlQVD1HV6o/+VuKIRDe/ExB3OXKwpkzjAfOn++cdjX+ N15tt8a2BCLf/fmZl0yDm9sN2sjICsDew/tgZBx9q6QdA5G3PP UdSEsqkUcw+tYVmQDLPmBs1y3OoYdiPMQCfvSIoGvWp9w1dnnE Ec+V++B1eNRPwrZx+Fp1N4l+RzS7h9osw7XAugwiZTPbVq4Qef /dKviYlZVsT/AJkyn78HZ4wzxYJLOcrqe0Z6KjP2o X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 14303 Cc: 14303@debbugs.gnu.org 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: -1.9 (-) Am 16.05.2013 06:02, schrieb Leo Liu: > On 2013-05-16 00:13 +0800, Andreas Röhler wrote: >> syntax-ppss is reliable, while re-search-backward comment-start-skip >> might stop inside a string etc. >> >> backward-line, end-of-line >> if nt4 and nth8, goto char nth8 >> >> that's nearly all >> as done consider limit of search, sure. >> >> Watching with interest, >> >> Andreas > > I don't know what to make of this comment. Do you see a problem in the > patch? > Yes, same thing as with beg-of-defun discussed elsewhere. + (while (and (not found) (re-search-backward comment-start-skip limit t)) + (setq end (match-end 0)) + (or (nth 8 (syntax-ppss)) (setq found t))) This might find a comment-start inside a string. Rely at (syntax-ppss) if nt4 and nth8, goto char nth8 Cheers, Andreas > Thanks, > Leo > From debbugs-submit-bounces@debbugs.gnu.org Thu May 16 09:29:10 2013 Received: (at 14303) by debbugs.gnu.org; 16 May 2013 13:29:10 +0000 Received: from localhost ([127.0.0.1]:47202 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UcyF4-00046e-6m for submit@debbugs.gnu.org; Thu, 16 May 2013 09:29:10 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:26247) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UcyF0-00046G-5H for 14303@debbugs.gnu.org; Thu, 16 May 2013 09:29:07 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFG4rwb8/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJIgeBsEtkQoDpHqBXoMT X-IPAS-Result: Av4EABK/CFG4rwb8/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJIgeBsEtkQoDpHqBXoMT X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="12848126" Received: from 184-175-6-252.dsl.teksavvy.com (HELO pastel.home) ([184.175.6.252]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 16 May 2013 09:28:45 -0400 Received: by pastel.home (Postfix, from userid 20848) id F09ED630F3; Thu, 16 May 2013 09:28:49 -0400 (EDT) From: Stefan Monnier To: Leo Liu Subject: Re: bug#14303: 24.3; Bug in comment-search-backward Message-ID: References: Date: Thu, 16 May 2013 09:28:49 -0400 In-Reply-To: (Leo Liu's message of "Wed, 15 May 2013 19:33:23 +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.0 (/) X-Debbugs-Envelope-To: 14303 Cc: 14303@debbugs.gnu.org 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: -1.9 (-) > So it is no longer fine for comment-search-backward to end up in a > comment or string any more. I'd like to know a bit more about "no longer": what has changed? IIUC the change is that you want to use comment-search-backward in a different circumstance, but I don't really understand what is that circumstance. > How about something like this? It looks OK, though please only use syntax-ppss if comment-use-syntax is set, because some modes still use comment commands in contexts where the syntax tables do not reflect the intended comment syntax. Stefan From debbugs-submit-bounces@debbugs.gnu.org Thu May 16 11:51:15 2013 Received: (at submit) by debbugs.gnu.org; 16 May 2013 15:51:15 +0000 Received: from localhost ([127.0.0.1]:47552 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Ud0SY-0001NO-GR for submit@debbugs.gnu.org; Thu, 16 May 2013 11:51:15 -0400 Received: from eggs.gnu.org ([208.118.235.92]:45721) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Ud0SV-0001N7-RP for submit@debbugs.gnu.org; Thu, 16 May 2013 11:51:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ud0SE-0001Jl-6v for submit@debbugs.gnu.org; Thu, 16 May 2013 11:50:55 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-101.1 required=5.0 tests=BAYES_05,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, USER_IN_WHITELIST autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:50119) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ud0SE-0001Jh-0e for submit@debbugs.gnu.org; Thu, 16 May 2013 11:50:54 -0400 Received: from eggs.gnu.org ([208.118.235.92]:57073) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ud0SC-0002HY-3X for bug-gnu-emacs@gnu.org; Thu, 16 May 2013 11:50:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ud0S7-0001Iz-7e for bug-gnu-emacs@gnu.org; Thu, 16 May 2013 11:50:51 -0400 Received: from plane.gmane.org ([80.91.229.3]:55548) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ud0S6-0001Iq-Ts for bug-gnu-emacs@gnu.org; Thu, 16 May 2013 11:50:47 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Ud0S4-0001Wg-In for bug-gnu-emacs@gnu.org; Thu, 16 May 2013 17:50:44 +0200 Received: from li511-224.members.linode.com ([66.175.216.224]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 16 May 2013 17:50:44 +0200 Received: from sdl.web by li511-224.members.linode.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 16 May 2013 17:50:44 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: bug-gnu-emacs@gnu.org From: Leo Liu Subject: Re: bug#14303: 24.3; Bug in comment-search-backward Date: Thu, 16 May 2013 23:50:33 +0800 Lines: 19 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: li511-224.members.linode.com Face: iVBORw0KGgoAAAANSUhEUgAAACkAAAApAQAAAACAGz1bAAABKElEQVQYlWNg3NIt5FDPUPt7 4+X79Qyucz5/ugik+L2PBgKpyphaIK921q23QDnG0NBQoMr/vaWl9f8ZLL78uPv5PwN7RETfzXoG jhmFz27XM0RXmpuY/WfY+fv0Mc56BvFybfXA/wwL5t/wF61n2PU59axXPcOVzbmSW/8zrNt1benC /ww70hqUU/4zKCtrT9jwn8FhwynbufUMendE2aLqGRpdX9al1zM8eh17lKeeQcTMrdD5P8P3j/YT Q/8zXHSb7p1Qz/C4OM2JuZ7hgtI7K6AjqsMnf8j4z8C6xG1tw3+GqpqvsVn/GTzmpD9j/8/wP/oZ S/l/Bka+QO/g/wy15ueeFQL9N1O8mPU/g+umV3t1gdT0/1bTgHLqYVeXAlWKpMWt+w8Az82C9nHf X0cAAAAASUVORK5CYII= User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (OS X 10.8.3) Cancel-Lock: sha1:A2PsP5qU0Lg+TdpYwIMG9wfYK9g= 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: -6.9 (------) 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: -6.9 (------) On 2013-05-16 21:28 +0800, Stefan Monnier wrote: > I'd like to know a bit more about "no longer": what has changed? > > IIUC the change is that you want to use comment-search-backward in > a different circumstance, but I don't really understand what is > that circumstance. In octave mode, insert the following line: printf ("aaaa dddd dddd dddd dddd dddd dddd dddd dddd dddd dddd #i", abcd) move point to the beginning of last word 'abcd' and type M-j. Also people have been observing weird behaviour in auto-fill-mode or fill-paragraph of comment chars insertion that seems come from nowhere. For example, in early org mode versions (probably version 4 or so) there have been constant reports of such behaviours. Leo From debbugs-submit-bounces@debbugs.gnu.org Thu May 16 13:38:49 2013 Received: (at 14303) by debbugs.gnu.org; 16 May 2013 17:38:49 +0000 Received: from localhost ([127.0.0.1]:47668 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Ud28e-0005Ke-QJ for submit@debbugs.gnu.org; Thu, 16 May 2013 13:38:48 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:46933) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Ud28d-0005KG-FW for 14303@debbugs.gnu.org; Thu, 16 May 2013 13:38:47 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFG4rwb8/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJIgeBsEtkQoDpHqBXoMT X-IPAS-Result: Av4EABK/CFG4rwb8/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJIgeBsEtkQoDpHqBXoMT X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="12974633" Received: from 184-175-6-252.dsl.teksavvy.com (HELO pastel.home) ([184.175.6.252]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 16 May 2013 13:38:25 -0400 Received: by pastel.home (Postfix, from userid 20848) id C4CB463364; Thu, 16 May 2013 13:38:29 -0400 (EDT) From: Stefan Monnier To: Leo Liu Subject: Re: bug#14303: 24.3; Bug in comment-search-backward Message-ID: References: Date: Thu, 16 May 2013 13:38:29 -0400 In-Reply-To: (Leo Liu's message of "Thu, 16 May 2013 23:50:33 +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: -1.9 (-) X-Debbugs-Envelope-To: 14303 Cc: 14303@debbugs.gnu.org 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: -1.9 (-) > In octave mode, insert the following line: > printf ("aaaa dddd dddd dddd dddd dddd dddd dddd dddd dddd dddd #i", abcd) > move point to the beginning of last word 'abcd' and type M-j. Right, that makes sense. Stefan From debbugs-submit-bounces@debbugs.gnu.org Thu May 16 20:36:08 2013 Received: (at 14303) by debbugs.gnu.org; 17 May 2013 00:36:08 +0000 Received: from localhost ([127.0.0.1]:48042 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Ud8eV-0004xW-Q1 for submit@debbugs.gnu.org; Thu, 16 May 2013 20:36:08 -0400 Received: from mail-pa0-f48.google.com ([209.85.220.48]:39939) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Ud8eS-0004wo-Kl for 14303@debbugs.gnu.org; Thu, 16 May 2013 20:36:06 -0400 Received: by mail-pa0-f48.google.com with SMTP id kp6so3025151pab.35 for <14303@debbugs.gnu.org>; Thu, 16 May 2013 17:35:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:references:face:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=dv1uRhPFJdOos9JPYq2Bas6h4pj4cWwAqKkE17ggkI8=; b=ORWTwqw9oY5xzy9yYedIDVDjHaEi/0P6lgtPnLY773b8jYapqMiVp9KYx+bPq6za7S KUL8aJm4kgz6dht/7oUD8zJ5Nsa0nBGVoARO5xzf3cVYKMDacCSeph8pkDt5DVUYGfS3 lnWz95JIhVIG8fdb0XAkiMUhVu7Qo4CJ/Y/ocS1qhe7F2AKdiFd7tCGROhxt16P5nBVg e4bIRS4c04tss25lnPKHpHg/j/cMNpT/jmNGhKGFx6UP+YfOZgJZRnpT4f4YPqbMk64f SyqbSZRH6iMYM/kGExuAuuJ5hm0HKB4h0souxtarv8e5tPCf64hsVx6cd5Hpjk6uYWYm 5kaA== X-Received: by 10.68.197.195 with SMTP id iw3mr45226605pbc.177.1368750945664; Thu, 16 May 2013 17:35:45 -0700 (PDT) Received: from Zeuss-MacBook.local (li511-224.members.linode.com. [66.175.216.224]) by mx.google.com with ESMTPSA id r6sm9582798pae.18.2013.05.16.17.35.41 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 16 May 2013 17:35:44 -0700 (PDT) From: Leo Liu To: Stefan Monnier Subject: Re: bug#14303: 24.3; Bug in comment-search-backward References: Face: iVBORw0KGgoAAAANSUhEUgAAACgAAAAoBAMAAAB+0KVeAAAAG1BMVEUAAAA9Cgm3Hx1WWFWA gn+WmJWsrqv4+vcCAwCRl2MkAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAAYoA AAGKATOXMFgAAAAHdElNRQfXAQwDNR+ZJmElAAABIklEQVQoz22SPW+DQAyGWUq65qasd9PNUSX4 AZHK2C1rJy5jpDS4IwRVup9dn7GNafpKIPPgzztXFSujqq1eM2n8h22oMkvxI/i9C97kRfMRUN55 dS3BrsAwBXUtMLAO4lryh8kTjOxKpQNniNxAgZOEe4bZwsDTFhKdqZRLNII4OQNHhEuq/RMkm6Cj TnnEA/fk0BorcYn5qA3oaeAxbaBOLrX+9G48NZ2Fzc2tzDM8Q+tMypEOqYHh8mAWaaK3U/cDMOT5 aMZMABgPXc7zPMs1A8DXO756GFJ/4fMEq47hTsAdn5avoxZ4ywl0c2w4Flu2Ybeyb3S+EqxX2DYA H8veJGEDTnHnrXvRaPyt+2kSfK6rfBZ2tUtfP/mR+pR6sX8BUZ/cDV7tvkoAAAAASUVORK5CYII= Date: Fri, 17 May 2013 08:35:35 +0800 In-Reply-To: (Stefan Monnier's message of "Thu, 16 May 2013 13:38:29 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (OS X 10.8.3) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 14303 Cc: 14303@debbugs.gnu.org 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: -2.6 (--) On 2013-05-17 01:38 +0800, Stefan Monnier wrote: > Right, that makes sense. > > > Stefan In that case I plan to install the patch as attached. I have found that it is very easy for people who provide customised comment-start-skip to introduce bugs. For example octave mode used to have "\\s<+\\s-*" as comment start skip and was lucky to work in the buggy comment-search-backward. I wonder what to do here. Better documentation on comment-start-skip to inform people that it is used both in re-search-forward/backward and better be anchored properly? diff --git a/lisp/newcomment.el b/lisp/newcomment.el index d55feaa3..db07e6a9 100644 --- a/lisp/newcomment.el +++ b/lisp/newcomment.el @@ -485,27 +485,26 @@ (defun comment-search-backward (&optional limit noerror) Moves point to inside the comment and returns the position of the comment-starter. If no comment is found, moves point to LIMIT and raises an error or returns nil if NOERROR is non-nil." - ;; FIXME: If a comment-start appears inside a comment, we may erroneously - ;; stop there. This can be rather bad in general, but since - ;; comment-search-backward is only used to find the comment-column (in - ;; comment-set-column) and to find the comment-start string (via - ;; comment-beginning) in indent-new-comment-line, it should be harmless. - (if (not (re-search-backward comment-start-skip limit t)) - (unless noerror (error "No comment")) - (beginning-of-line) - (let* ((end (match-end 0)) - (cs (comment-search-forward end t)) - (pt (point))) - (if (not cs) - (progn (beginning-of-line) - (comment-search-backward limit noerror)) - (while (progn (goto-char cs) - (comment-forward) - (and (< (point) end) - (setq cs (comment-search-forward end t)))) - (setq pt (point))) - (goto-char pt) - cs)))) + (let (found end) + (while (and (not found) (re-search-backward comment-start-skip limit t)) + (setq end (match-end 0)) + (unless (and comment-use-syntax (nth 8 (syntax-ppss))) + (setq found t))) + (if (not found) + (unless noerror (error "No comment")) + (beginning-of-line) + (let ((cs (comment-search-forward end t)) + (pt (point))) + (if (not cs) + (progn (beginning-of-line) + (comment-search-backward limit noerror)) + (while (progn (goto-char cs) + (comment-forward) + (and (< (point) end) + (setq cs (comment-search-forward end t)))) + (setq pt (point))) + (goto-char pt) + cs))))) (defun comment-beginning () "Find the beginning of the enclosing comment. -- 1.8.2 From debbugs-submit-bounces@debbugs.gnu.org Fri May 17 06:48:21 2013 Received: (at 14303) by debbugs.gnu.org; 17 May 2013 10:48:21 +0000 Received: from localhost ([127.0.0.1]:48485 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UdICy-0008Nt-UY for submit@debbugs.gnu.org; Fri, 17 May 2013 06:48:21 -0400 Received: from mail-pb0-f51.google.com ([209.85.160.51]:59963) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UdICv-0008Nf-NI for 14303@debbugs.gnu.org; Fri, 17 May 2013 06:48:18 -0400 Received: by mail-pb0-f51.google.com with SMTP id jt11so2132376pbb.10 for <14303@debbugs.gnu.org>; Fri, 17 May 2013 03:47:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:references:face:date:in-reply-to :message-id:user-agent:mime-version:content-type :content-transfer-encoding; bh=QS4MDv/HNy0W4wqf0cfaGeQptM0Gu/1NEVtjI2cUTZ4=; b=GnoWYqtL9SItGnu7/JG9AMtXjAxD18yb9SaeH0fW+KlvqZbbP8eVHEf7vSo3iJF8BV 6daZ0rIwYI0dEEp5HjLiygAps1d6i3kW2n1HVUizEkSxNEvbq8HAeA65gg4EyGd9D5wZ NHB53RF+pZ1QYWGj6Hyq11Y43yR/OtXnmkW6O2puBhO/K/UxqaXp1XMON0CQ5VH7bkar ezilyhgJ1I+YdyTivK222x3dHcXNBC0D8/bbHMwuzlTWn9wgpAUioVW4fbZ8N3n9tkeJ 3J3Mn379DpzLWjpJjrcf3hX07PzQzJATPK2WE9eXQ5TTtaJ/kW9muYIF1wHSu08Q/TEE ageQ== X-Received: by 10.66.151.46 with SMTP id un14mr49080456pab.14.1368787676036; Fri, 17 May 2013 03:47:56 -0700 (PDT) Received: from localhost (li511-224.members.linode.com. [66.175.216.224]) by mx.google.com with ESMTPSA id gc5sm10782660pbb.19.2013.05.17.03.47.53 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 17 May 2013 03:47:55 -0700 (PDT) From: Leo Liu To: Andreas =?iso-8859-1?Q?R=F6hler?= Subject: Re: bug#14303: 24.3; Bug in comment-search-backward References: <5193B43B.8070007@easy-emacs.de> <519486DD.1040505@easy-emacs.de> Face: iVBORw0KGgoAAAANSUhEUgAAACgAAAAoBAMAAAB+0KVeAAAAG1BMVEUAAAA9Cgm3Hx1WWFWA gn+WmJWsrqv4+vcCAwCRl2MkAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAAYoA AAGKATOXMFgAAAAHdElNRQfXAQwDNR+ZJmElAAABIklEQVQoz22SPW+DQAyGWUq65qasd9PNUSX4 AZHK2C1rJy5jpDS4IwRVup9dn7GNafpKIPPgzztXFSujqq1eM2n8h22oMkvxI/i9C97kRfMRUN55 dS3BrsAwBXUtMLAO4lryh8kTjOxKpQNniNxAgZOEe4bZwsDTFhKdqZRLNII4OQNHhEuq/RMkm6Cj TnnEA/fk0BorcYn5qA3oaeAxbaBOLrX+9G48NZ2Fzc2tzDM8Q+tMypEOqYHh8mAWaaK3U/cDMOT5 aMZMABgPXc7zPMs1A8DXO756GFJ/4fMEq47hTsAdn5avoxZ4ywl0c2w4Flu2Ybeyb3S+EqxX2DYA H8veJGEDTnHnrXvRaPyt+2kSfK6rfBZ2tUtfP/mR+pR6sX8BUZ/cDV7tvkoAAAAASUVORK5CYII= Date: Fri, 17 May 2013 18:47:48 +0800 In-Reply-To: <519486DD.1040505@easy-emacs.de> ("Andreas \=\?iso-8859-1\?Q\?R\?\= \=\?iso-8859-1\?Q\?\=F6hler\=22's\?\= message of "Thu, 16 May 2013 09:12:29 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (OS X 10.8.3) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 14303 Cc: 14303@debbugs.gnu.org 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: -2.6 (--) On 2013-05-16 15:12 +0800, Andreas R=F6hler wrote: > Yes, same thing as with beg-of-defun discussed elsewhere. > > + (while (and (not found) (re-search-backward comment-start-skip limit t)) > + (setq end (match-end 0)) > + (or (nth 8 (syntax-ppss)) (setq found t))) > > This might find a comment-start inside a string. > > Rely at (syntax-ppss) > > if nt4 and nth8, goto char nth8 There is possibility of ending up in a string. How about something along these lines? Thanks. Leo diff --git a/lisp/newcomment.el b/lisp/newcomment.el index d55feaa3..79cdc393 100644 --- a/lisp/newcomment.el +++ b/lisp/newcomment.el @@ -485,27 +485,30 @@ (defun comment-search-backward (&optional limit noerr= or) Moves point to inside the comment and returns the position of the comment-starter. If no comment is found, moves point to LIMIT and raises an error or returns nil if NOERROR is non-nil." - ;; FIXME: If a comment-start appears inside a comment, we may erroneously - ;; stop there. This can be rather bad in general, but since - ;; comment-search-backward is only used to find the comment-column (in - ;; comment-set-column) and to find the comment-start string (via - ;; comment-beginning) in indent-new-comment-line, it should be harmless. - (if (not (re-search-backward comment-start-skip limit t)) - (unless noerror (error "No comment")) - (beginning-of-line) - (let* ((end (match-end 0)) - (cs (comment-search-forward end t)) - (pt (point))) - (if (not cs) - (progn (beginning-of-line) - (comment-search-backward limit noerror)) - (while (progn (goto-char cs) - (comment-forward) - (and (< (point) end) - (setq cs (comment-search-forward end t)))) - (setq pt (point))) - (goto-char pt) - cs)))) + (let (found end beg) + (while (and (not found) (re-search-backward comment-start-skip limit t= )) + (setq beg (or (match-end 1) (match-beginning 0)) + end (match-end 0)) + (when (or (not comment-use-syntax) + (and (not (nth 8 (syntax-ppss beg))) + (nth 4 (syntax-ppss end)))) + (setq found t)) + (goto-char beg)) + (if (not found) + (unless noerror (error "No comment")) + (beginning-of-line) + (let ((cs (comment-search-forward end t)) + (pt (point))) + (if (not cs) + (progn (beginning-of-line) + (comment-search-backward limit noerror)) + (while (progn (goto-char cs) + (comment-forward) + (and (< (point) end) + (setq cs (comment-search-forward end t)))) + (setq pt (point))) + (goto-char pt) + cs))))) =20 (defun comment-beginning () "Find the beginning of the enclosing comment. From debbugs-submit-bounces@debbugs.gnu.org Fri May 17 07:12:50 2013 Received: (at 14303) by debbugs.gnu.org; 17 May 2013 11:12:50 +0000 Received: from localhost ([127.0.0.1]:48510 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UdIag-0000ZL-4d for submit@debbugs.gnu.org; Fri, 17 May 2013 07:12:50 -0400 Received: from moutng.kundenserver.de ([212.227.17.8]:54653) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UdIac-0000Z6-TX for 14303@debbugs.gnu.org; Fri, 17 May 2013 07:12:48 -0400 Received: from [192.168.178.21] (brln-4dbc7c0d.pool.mediaWays.net [77.188.124.13]) by mrelayeu.kundenserver.de (node=mrbap3) with ESMTP (Nemesis) id 0M5xcn-1UJyPe2uGf-00xw42; Fri, 17 May 2013 13:12:24 +0200 Message-ID: <51961132.1040703@easy-emacs.de> Date: Fri, 17 May 2013 13:14:58 +0200 From: =?ISO-8859-1?Q?Andreas_R=F6hler?= User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: Leo Liu Subject: Re: bug#14303: 24.3; Bug in comment-search-backward References: <5193B43B.8070007@easy-emacs.de> <519486DD.1040505@easy-emacs.de> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Provags-ID: V02:K0:mEuSJVAZDf0lZh6vKnPcKzZD5hLMyPdclrUDz+oAlZS ToFXsPbF2OzM+7EISBm34/omZGnNBcQYd1ZkvYxz9C429X9tyy qp6ULFdf6xF0JoYegohLzn2fusEWJrDfOefwYlqWiRabYFf52S ybx3pM1aWLsp+65s0l5zoj7TQyrfFzgfHn5Ax8hpma3ep5rPcG QdXJZNQQbHyfhOIiwvRs6q0EUeH2SooGJpl3K57VqmYgNBN+qW urRAQ7d5eMchI6u+22cfiBHaUiiGsLUG8269wbE/1d4mTVUKd0 YUshrWbBLQO7Ctro2eW6x0NgWm3orpIN6PHRWs/zspqhlaLmx7 CqqXDFVoDqlXRG9eqTah2x9kbsB2vG1wKt/YvQGSm X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 14303 Cc: 14303@debbugs.gnu.org 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: -1.9 (-) Am 17.05.2013 12:47, schrieb Leo Liu: > On 2013-05-16 15:12 +0800, Andreas Röhler wrote: >> Yes, same thing as with beg-of-defun discussed elsewhere. >> >> + (while (and (not found) (re-search-backward comment-start-skip limit t)) >> + (setq end (match-end 0)) >> + (or (nth 8 (syntax-ppss)) (setq found t))) >> >> This might find a comment-start inside a string. >> >> Rely at (syntax-ppss) >> >> if nt4 and nth8, goto char nth8 > > There is possibility of ending up in a string. How about something along > these lines? Thanks. Leo > > diff --git a/lisp/newcomment.el b/lisp/newcomment.el > index d55feaa3..79cdc393 100644 > --- a/lisp/newcomment.el > +++ b/lisp/newcomment.el > @@ -485,27 +485,30 @@ (defun comment-search-backward (&optional limit noerror) > Moves point to inside the comment and returns the position of the > comment-starter. If no comment is found, moves point to LIMIT > and raises an error or returns nil if NOERROR is non-nil." > - ;; FIXME: If a comment-start appears inside a comment, we may erroneously > - ;; stop there. This can be rather bad in general, but since > - ;; comment-search-backward is only used to find the comment-column (in > - ;; comment-set-column) and to find the comment-start string (via > - ;; comment-beginning) in indent-new-comment-line, it should be harmless. > - (if (not (re-search-backward comment-start-skip limit t)) > - (unless noerror (error "No comment")) > - (beginning-of-line) > - (let* ((end (match-end 0)) > - (cs (comment-search-forward end t)) > - (pt (point))) > - (if (not cs) > - (progn (beginning-of-line) > - (comment-search-backward limit noerror)) > - (while (progn (goto-char cs) > - (comment-forward) > - (and (< (point) end) > - (setq cs (comment-search-forward end t)))) > - (setq pt (point))) > - (goto-char pt) > - cs)))) > + (let (found end beg) > + (while (and (not found) (re-search-backward comment-start-skip limit t)) > + (setq beg (or (match-end 1) (match-beginning 0)) > + end (match-end 0)) > + (when (or (not comment-use-syntax) > + (and (not (nth 8 (syntax-ppss beg))) > + (nth 4 (syntax-ppss end)))) > + (setq found t)) > + (goto-char beg)) > + (if (not found) > + (unless noerror (error "No comment")) > + (beginning-of-line) > + (let ((cs (comment-search-forward end t)) > + (pt (point))) > + (if (not cs) > + (progn (beginning-of-line) > + (comment-search-backward limit noerror)) > + (while (progn (goto-char cs) > + (comment-forward) > + (and (< (point) end) > + (setq cs (comment-search-forward end t)))) > + (setq pt (point))) > + (goto-char pt) > + cs))))) > > (defun comment-beginning () > "Find the beginning of the enclosing comment. > The succession of things doesn't look right yet. if (eq comment-use-syntax nil) re-search-backward based solution which is very seldom. Grep shows 4 cases. Otherwise syntax-ppss - , prog1 and nth 4 goto char nth 8 - or so. Make sure wrong regexp isn't called then/no wrong matches. Andreas From debbugs-submit-bounces@debbugs.gnu.org Fri May 17 07:34:50 2013 Received: (at 14303) by debbugs.gnu.org; 17 May 2013 11:34:50 +0000 Received: from localhost ([127.0.0.1]:48529 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UdIvx-00025G-15 for submit@debbugs.gnu.org; Fri, 17 May 2013 07:34:49 -0400 Received: from mail-pa0-f44.google.com ([209.85.220.44]:50104) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UdIvu-00024w-Sv for 14303@debbugs.gnu.org; Fri, 17 May 2013 07:34:47 -0400 Received: by mail-pa0-f44.google.com with SMTP id jh10so3490855pab.17 for <14303@debbugs.gnu.org>; Fri, 17 May 2013 04:34:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:references:face:date:in-reply-to :message-id:user-agent:mime-version:content-type :content-transfer-encoding; bh=JrNDk9SzUem896QmlcOH1xMc+n6Sc5k9bwRT29jY37s=; b=gbmPF3PpVNdEf9AEWFCiGMP7+dQ4YDav4haRpKPiSBYuTeqvGicbb/4P6rbQLCPyPQ GtwcybfRDy2mc/lZYfaSiqj5O8K4apfzWABCmbcWpuRLblsL4dMrveEvsPGXKwG8khp9 0FVeZySmWEShEz6LnQ4qlKx/9QtmGLo8mXT/4jWCX+Vj8YNjyB+AV1hZzAk4nTzByEPr YmMqUedTo8b7pCJ94myepuZVyvvx6tD+dwsIQB4YlGgZWqg5KztSI41P+y5lktZyGpS8 5S8jjtMOE8mqpIsyrmLlVJ9jaYasJTpWwovygBdK//PDkaFRb3J81urEdd2u6LTAJweg YtQQ== X-Received: by 10.66.151.142 with SMTP id uq14mr49203926pab.50.1368790465092; Fri, 17 May 2013 04:34:25 -0700 (PDT) Received: from Zeuss-MacBook.local (li511-224.members.linode.com. [66.175.216.224]) by mx.google.com with ESMTPSA id wp6sm10902927pbc.29.2013.05.17.04.34.22 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 17 May 2013 04:34:24 -0700 (PDT) From: Leo Liu To: Andreas =?iso-8859-1?Q?R=F6hler?= Subject: Re: bug#14303: 24.3; Bug in comment-search-backward References: <5193B43B.8070007@easy-emacs.de> <519486DD.1040505@easy-emacs.de> <51961132.1040703@easy-emacs.de> Face: iVBORw0KGgoAAAANSUhEUgAAACgAAAAoAgMAAADxkFD+AAAADFBMVEUvT09qWs3/pQD///+J kUVcAAAAAWJLR0QAiAUdSAAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9cBBwMLOd3veKQA AACuSURBVBjTldE9CgIxEAXgB+lEyFUC2wo5ikdZ8DSypxhMY7H9VuIVwlqkGRgnm59VsHGafIQ3 CZlAtmKIRaHETgYa12lqvEsPYKf8wXHsPGfqPaUM0g9aJPKFXkmNQmSDqwzz4Fpgpz+6WAPY2z5o uPJJpu0uypcl4nyCibMLQ8lCiVjayLoQvw5LsVKQuHPRR958HZbOcVsKeepcLxpByjycGvnKmY+c MBvrtyjfe0vmuLvdq/kAAAAASUVORK5CYII= Date: Fri, 17 May 2013 19:34:17 +0800 In-Reply-To: <51961132.1040703@easy-emacs.de> ("Andreas \=\?iso-8859-1\?Q\?R\?\= \=\?iso-8859-1\?Q\?\=F6hler\=22's\?\= message of "Fri, 17 May 2013 13:14:58 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (OS X 10.8.3) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 14303 Cc: 14303@debbugs.gnu.org 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: -2.6 (--) On 2013-05-17 19:14 +0800, Andreas R=F6hler wrote: > The succession of things doesn't look right yet. > > if (eq comment-use-syntax nil) > > re-search-backward based solution > > which is very seldom. Grep shows 4 cases. > > Otherwise syntax-ppss - , prog1 and nth 4 goto char nth 8 - or so. > Make sure wrong regexp isn't called then/no wrong matches. > > Andreas There is possible optimisation when 'end' is in a string. Other than that do you have a case where my solution will fail? Leo From debbugs-submit-bounces@debbugs.gnu.org Fri May 17 08:37:10 2013 Received: (at 14303) by debbugs.gnu.org; 17 May 2013 12:37:10 +0000 Received: from localhost ([127.0.0.1]:48594 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UdJuH-0004N5-OE for submit@debbugs.gnu.org; Fri, 17 May 2013 08:37:10 -0400 Received: from moutng.kundenserver.de ([212.227.17.9]:52341) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UdJuE-0004M8-Kf for 14303@debbugs.gnu.org; Fri, 17 May 2013 08:37:08 -0400 Received: from [192.168.178.21] (brln-4dbc7c0d.pool.mediaWays.net [77.188.124.13]) by mrelayeu.kundenserver.de (node=mrbap3) with ESMTP (Nemesis) id 0Lbqzs-1UBvB83tBs-00jFVf; Fri, 17 May 2013 14:36:43 +0200 Message-ID: <519624F5.5040600@easy-emacs.de> Date: Fri, 17 May 2013 14:39:17 +0200 From: =?ISO-8859-1?Q?Andreas_R=F6hler?= User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: Leo Liu Subject: Re: bug#14303: 24.3; Bug in comment-search-backward References: <5193B43B.8070007@easy-emacs.de> <519486DD.1040505@easy-emacs.de> <51961132.1040703@easy-emacs.de> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Provags-ID: V02:K0:raPib3eORjtfU9QoN8XWEEENVLtVJncGV10Y/v/Cp5h A53hPF6u1YljndqIwcU5+hXmWkNkLGU1kuwqk6/rJnZWU7PRYN J3+nvb/4FX1Dn6fSm7E1PZpPZ27dzYU+KaqgmCQb6P34pYWgEW ZEE8JPAarFP343INwN75RMoDoK/ovSAEHNjkMjj8mfLELehLH6 LcBQM0TXtQRuPsSESHg1Nqi5pdEFgGRqwsIFCU4XGauKKJ6WcJ J7EFyre/yp909ZmWHqVAbWvYl31cJYwE2EvvCbRKKcQ9tkgXpk dqDg8YAoXJLgOjsMvDyF25XB48+8+gmhdmPuxSUeNj2XAYM2bN kndE0f7sGztFHbMZQSnQnaxliKgc2o2iRA3u4WrJj X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 14303 Cc: 14303@debbugs.gnu.org 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: -1.9 (-) Am 17.05.2013 13:34, schrieb Leo Liu: > On 2013-05-17 19:14 +0800, Andreas Röhler wrote: >> The succession of things doesn't look right yet. >> >> if (eq comment-use-syntax nil) >> >> re-search-backward based solution >> >> which is very seldom. Grep shows 4 cases. >> >> Otherwise syntax-ppss - , prog1 and nth 4 goto char nth 8 - or so. >> Make sure wrong regexp isn't called then/no wrong matches. >> >> Andreas > > There is possible optimisation when 'end' is in a string. Don't understand. "end" can't be in a string, if syntax-ppss is used. Other than > that do you have a case where my solution will fail? Not just fail. However most if this code looks redundant, useless employing of re-search-..., which will slow down Emacs when called from a program. > > Leo > From debbugs-submit-bounces@debbugs.gnu.org Fri May 17 09:18:48 2013 Received: (at 14303) by debbugs.gnu.org; 17 May 2013 13:18:48 +0000 Received: from localhost ([127.0.0.1]:48633 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UdKYZ-00062K-BO for submit@debbugs.gnu.org; Fri, 17 May 2013 09:18:47 -0400 Received: from mail-pb0-f53.google.com ([209.85.160.53]:45750) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UdKYX-00061n-2k for 14303@debbugs.gnu.org; Fri, 17 May 2013 09:18:45 -0400 Received: by mail-pb0-f53.google.com with SMTP id un1so3301487pbc.12 for <14303@debbugs.gnu.org>; Fri, 17 May 2013 06:18:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:references:face:date:in-reply-to :message-id:user-agent:mime-version:content-type :content-transfer-encoding; bh=Kqv7BROIuE0YE02dcQ8c7TXwW3+c4gbWKd3QbMSOJ3w=; b=Z1tqqYN5uBoQa4O/D3w8xdLVeet2FGiR8fPnYZ8laULocoD0FUZbMX5DtjCO5pM5sk 7d3hoS4YUrXui17TjtJMh25+R38QHwb1uDOhrzIfhB8Qmib6ObfYtww6NIX2/tGsfVdZ yxRZsb7mEGH4GGe9NLP1UGs5khwQjl/IGllTWdffnF5RG5D1lp7IPehPyY9NdpZevHk5 2A5W6P5mwiPIBQMeMqwM/hAqmoWavmE4o1+ADWRzGDn/YZPvdOr7etSbifMr5gMPPsv3 dqgZlkZd23rw8pV6+Bw/rMtzheAICJ7ZmiS91mAZrH3bl7nWqQhmKsJ9439Ivw6UcZAm vFMw== X-Received: by 10.68.212.168 with SMTP id nl8mr48046778pbc.43.1368796702899; Fri, 17 May 2013 06:18:22 -0700 (PDT) Received: from Zeuss-MacBook.local (li511-224.members.linode.com. [66.175.216.224]) by mx.google.com with ESMTPSA id vz8sm12194532pac.20.2013.05.17.06.18.20 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 17 May 2013 06:18:22 -0700 (PDT) From: Leo Liu To: Andreas =?iso-8859-1?Q?R=F6hler?= Subject: Re: bug#14303: 24.3; Bug in comment-search-backward References: <5193B43B.8070007@easy-emacs.de> <519486DD.1040505@easy-emacs.de> <51961132.1040703@easy-emacs.de> <519624F5.5040600@easy-emacs.de> Face: iVBORw0KGgoAAAANSUhEUgAAACgAAAAoBAMAAAB+0KVeAAAAMFBMVEUaFRZLMy1dTENxVzKQ WiCrXQ97cmO/dSqSh3akjGTApXy5sJ7Sxo/Sz8Xo6eP9//xJbkruAAAAAWJLR0QAiAUdSAAAAAlw SFlzAAACxQAAAsUBidZ/7wAAAAd0SU1FB9cBBwMJOwHXewoAAAIBSURBVCjPVdNBiNNAFADQ6J4F x3hThHZBBC+WCFI8SS0iezRDcMHLHkLAg6gJH/fgYQ9xYlj2sLK4KHgqCgXFhda2Idmr4kkQPZQ0 nkQMbTypbMmMM2m7ZgYSmMef/5OZPwo7HFnx3uKPcmj0Dht1LWZJ+Hvr7dIFZXRUwl9VRTuuKDJ+ U44gjscknK4hhJaCkYRsWjmBtLqXlJAG2wipNe18OZJu1BBq1E8xafl4s6Jq2mUZGftU1y7CCxnp FVUDWJXx4C66BKBnErbuoaYNtoRTu6EZBsCbMn7W+5qOAR6WvxNOby9jHWC9hAf3n304CdiAByXs 3Nh9roLDkyb/sWV712vYwaLSAn8CPMHIAAzOPDKP2COAFm4Y4ODVWc6xG7KXsN7UeUJjjimx2uwd gCgNhr0i8C/xyCD5CiCKAMY3Bf5oDzx//w/fimscdcAZU2jv9sedx6+nYPPFIoWI/GK6QZ+EFGOR ErAjCnV3vPZ7XqlTIMbOLY7fLcvvmT7rXNWaGDexIY44N12TG2PDp7vqyl57dnCeuWwyNpnEURxk fTbDYeBnKRn4oejPYI4sH6WviBumEZ/GxX4X/x6EcURFZ7E071bjQGAxpcOAEOJuTiroDEea5Szv rVWLYfl7ZiQwSUToxrkux7OLixAWGz22+HIyWTRYcVfomOwvzusfjtVIGgLHf3MAAAAASUVORK5C YII= Date: Fri, 17 May 2013 21:18:10 +0800 In-Reply-To: <519624F5.5040600@easy-emacs.de> ("Andreas \=\?iso-8859-1\?Q\?R\?\= \=\?iso-8859-1\?Q\?\=F6hler\=22's\?\= message of "Fri, 17 May 2013 14:39:17 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (OS X 10.8.3) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 14303 Cc: 14303@debbugs.gnu.org, Stefan Monnier 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: -2.6 (--) On 2013-05-17 20:39 +0800, Andreas R=F6hler wrote: > Don't understand. "end" can't be in a string, if syntax-ppss is used. > > > Other than >> that do you have a case where my solution will fail? > > Not just fail. > However most if this code looks redundant, useless employing of > re-search-..., which will slow down Emacs when called from a program. Much as I would like to incorporate your suggestion I couldn't do so without fully understand your messages. I think we have two options: 1. if you have copyright assignment to FSF, post your patch and I will happily withdraw mine. 2. If not, leave my patch for Stefan to review. Leo From debbugs-submit-bounces@debbugs.gnu.org Fri May 17 09:27:15 2013 Received: (at 14303) by debbugs.gnu.org; 17 May 2013 13:27:16 +0000 Received: from localhost ([127.0.0.1]:48660 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UdKgV-0006Nd-5B for submit@debbugs.gnu.org; Fri, 17 May 2013 09:27:02 -0400 Received: from pruche.dit.umontreal.ca ([132.204.246.22]:40246) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UdKgQ-0006NQ-MM for 14303@debbugs.gnu.org; Fri, 17 May 2013 09:26:55 -0400 Received: from faina.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id r4HDQbFA013241; Fri, 17 May 2013 09:26:37 -0400 Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id 21210B4161; Fri, 17 May 2013 09:26:37 -0400 (EDT) From: Stefan Monnier To: Leo Liu Subject: Re: bug#14303: 24.3; Bug in comment-search-backward Message-ID: References: Date: Fri, 17 May 2013 09:26:37 -0400 In-Reply-To: (Leo Liu's message of "Fri, 17 May 2013 08:35:35 +0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4582=0 X-NAI-Spam-Version: 2.3.0.9362 : core <4582> : streams <962358> : uri <1422723> X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: 14303 Cc: 14303@debbugs.gnu.org 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: -4.2 (----) > + (while (and (not found) (re-search-backward comment-start-skip limit t)) > + (setq end (match-end 0)) > + (unless (and comment-use-syntax (nth 8 (syntax-ppss))) > + (setq found t))) BTW, a useful idiom for such loops is the "empty body" while loop. (while (and (re-search-backward comment-start-skip limit t) (progn (setq end (match-end 0)) (and comment-use-syntax (nth 8 (syntax-ppss)))))) -- Stefan From debbugs-submit-bounces@debbugs.gnu.org Fri May 17 09:28:51 2013 Received: (at 14303) by debbugs.gnu.org; 17 May 2013 13:28:51 +0000 Received: from localhost ([127.0.0.1]:48666 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UdKhu-0006R7-IA for submit@debbugs.gnu.org; Fri, 17 May 2013 09:28:51 -0400 Received: from chene.dit.umontreal.ca ([132.204.246.20]:54453) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UdKhp-0006Qk-BC for 14303@debbugs.gnu.org; Fri, 17 May 2013 09:28:22 -0400 Received: from faina.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id r4HDS4J9026530; Fri, 17 May 2013 09:28:04 -0400 Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id 881FBB4161; Fri, 17 May 2013 09:28:04 -0400 (EDT) From: Stefan Monnier To: Leo Liu Subject: Re: bug#14303: 24.3; Bug in comment-search-backward Message-ID: References: <5193B43B.8070007@easy-emacs.de> <519486DD.1040505@easy-emacs.de> Date: Fri, 17 May 2013 09:28:04 -0400 In-Reply-To: (Leo Liu's message of "Fri, 17 May 2013 18:47:48 +0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4582=0 X-NAI-Spam-Version: 2.3.0.9362 : core <4582> : streams <962359> : uri <1422725> X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: 14303 Cc: 14303@debbugs.gnu.org, Andreas =?iso-8859-1?Q?R=F6hler?= 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: -4.2 (----) >> Yes, same thing as with beg-of-defun discussed elsewhere. >> >> + (while (and (not found) (re-search-backward comment-start-skip limit t)) >> + (setq end (match-end 0)) >> + (or (nth 8 (syntax-ppss)) (setq found t))) >> >> This might find a comment-start inside a string. >> >> Rely at (syntax-ppss) >> >> if nt4 and nth8, goto char nth8 > There is possibility of ending up in a string. I don't understand when that can happen (when inside a string (nth 8 ppss) is also non-nil). Stefan From debbugs-submit-bounces@debbugs.gnu.org Fri May 17 09:38:07 2013 Received: (at 14303) by debbugs.gnu.org; 17 May 2013 13:38:07 +0000 Received: from localhost ([127.0.0.1]:48685 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UdKrF-0006qY-SO for submit@debbugs.gnu.org; Fri, 17 May 2013 09:38:06 -0400 Received: from mail-pb0-f52.google.com ([209.85.160.52]:43190) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UdKr7-0006px-10 for 14303@debbugs.gnu.org; Fri, 17 May 2013 09:38:03 -0400 Received: by mail-pb0-f52.google.com with SMTP id xa7so3304038pbc.39 for <14303@debbugs.gnu.org>; Fri, 17 May 2013 06:37:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:references:face:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=lCQUzOT9e/wu4TT2fzjyGQnKv+dUc115mF2rSZqHr64=; b=p7YnzzqfNrdkSjmXyxMK0nl0H4y5/cDGbH/tq7tpmKEMCGtUbPZOWtBxqJ6iEETQ0c 4abVYcyPapegv5YCOk7ZgKajBl6BOIKpbAJ6BoyJqaQU0nrWa2MfVtGatH5oa9uqZsMx HxGMYOBIvSfa0e56MjX4PCXjqL4QM26E5xn867yA8SKJc4w6Xu3kd1w7uS92GBWtNFZr H5uBVKIvR0iR7vJFMn+oSkF67sqlPWeC1yNAbFkjTu3UJOnszJXFLBTw2bDmYMQr8x6t Knn4+fJWHaGxOFqdF0Bkv7MAHcVS8GYOPlFOTCNreuqL4GaQLM8LKyBooD42MORLqp8B P70w== X-Received: by 10.66.217.226 with SMTP id pb2mr48884024pac.109.1368797854882; Fri, 17 May 2013 06:37:34 -0700 (PDT) Received: from Zeuss-MacBook.local (li511-224.members.linode.com. [66.175.216.224]) by mx.google.com with ESMTPSA id fn2sm11288975pbc.15.2013.05.17.06.37.30 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 17 May 2013 06:37:34 -0700 (PDT) From: Leo Liu To: Stefan Monnier Subject: Re: bug#14303: 24.3; Bug in comment-search-backward References: <5193B43B.8070007@easy-emacs.de> <519486DD.1040505@easy-emacs.de> Face: iVBORw0KGgoAAAANSUhEUgAAACgAAAAoAgMAAADxkFD+AAAADFBMVEUvT09qWs3/pQD///+J kUVcAAAAAWJLR0QAiAUdSAAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9cBBwMLOd3veKQA AACuSURBVBjTldE9CgIxEAXgB+lEyFUC2wo5ikdZ8DSypxhMY7H9VuIVwlqkGRgnm59VsHGafIQ3 CZlAtmKIRaHETgYa12lqvEsPYKf8wXHsPGfqPaUM0g9aJPKFXkmNQmSDqwzz4Fpgpz+6WAPY2z5o uPJJpu0uypcl4nyCibMLQ8lCiVjayLoQvw5LsVKQuHPRR958HZbOcVsKeepcLxpByjycGvnKmY+c MBvrtyjfe0vmuLvdq/kAAAAASUVORK5CYII= Date: Fri, 17 May 2013 21:37:25 +0800 In-Reply-To: (Stefan Monnier's message of "Fri, 17 May 2013 09:28:04 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (OS X 10.8.3) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 14303 Cc: 14303@debbugs.gnu.org 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: -2.6 (--) On 2013-05-17 21:28 +0800, Stefan Monnier wrote: > I don't understand when that can happen (when inside a string (nth > 8 ppss) is also non-nil). I have (defvar octave-comment-start-skip "\\(^\\|\\S<\\)\\(?:%!\\|\\s<+\\)\\s-*" "Octave-specific `comment-start-skip' (which see).") and this could find "#abc" as comment start where BEG is outside of strings and comments but END is in a string. Maybe this is due to setting octave-comment-start-skip incorrectly. I looked at comment-normalize-vars and see it uses: \\(\\(^\\|[^\\\n]\\)\\(\\\\\\\\\\)*\\) as anchor but I don't understand fully. Leo From debbugs-submit-bounces@debbugs.gnu.org Fri May 17 10:25:16 2013 Received: (at submit) by debbugs.gnu.org; 17 May 2013 14:25:16 +0000 Received: from localhost ([127.0.0.1]:49043 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UdLaq-0000Ue-OV for submit@debbugs.gnu.org; Fri, 17 May 2013 10:25:15 -0400 Received: from eggs.gnu.org ([208.118.235.92]:52512) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UdLak-0000Ti-NX for submit@debbugs.gnu.org; Fri, 17 May 2013 10:25:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UdLaN-0001YA-UZ for submit@debbugs.gnu.org; Fri, 17 May 2013 10:24:45 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-101.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, USER_IN_WHITELIST autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:33911) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UdLaN-0001Y5-Qk for submit@debbugs.gnu.org; Fri, 17 May 2013 10:24:43 -0400 Received: from eggs.gnu.org ([208.118.235.92]:35628) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UdLaM-0003vn-Cd for bug-gnu-emacs@gnu.org; Fri, 17 May 2013 10:24:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UdLaL-0001XL-8k for bug-gnu-emacs@gnu.org; Fri, 17 May 2013 10:24:42 -0400 Received: from moutng.kundenserver.de ([212.227.126.187]:63722) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UdLaL-0001XB-09 for bug-gnu-emacs@gnu.org; Fri, 17 May 2013 10:24:41 -0400 Received: from [192.168.178.21] (brln-4dbc7c0d.pool.mediaWays.net [77.188.124.13]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0MdXMC-1UrgXx2gJg-00PNnD; Fri, 17 May 2013 16:24:37 +0200 Message-ID: <51963E40.9020202@easy-emacs.de> Date: Fri, 17 May 2013 16:27:12 +0200 From: =?ISO-8859-15?Q?Andreas_R=F6hler?= User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: bug-gnu-emacs@gnu.org Subject: Re: bug#14303: 24.3; Bug in comment-search-backward References: <5193B43B.8070007@easy-emacs.de> <519486DD.1040505@easy-emacs.de> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:u9chUkfilIo8Vuc5Q8KyKwLjkfFB4HgoDMEsDYZJ8qG yK8AgHILJsaAgF3KvenBKcP61CbqMwaPLDGb9AaUBTXXdgr15T Ooctgd6i1/nZudb2I/Ohw/Eh2EyJEL3xo4sSrtjb2dr/Z6bqVb YIayoCX7rvOUha5ehcI1na4J3CLfowQmcQOQSurhLytMF0ttSL L0Aio8vhcAK20m3vpwf45qcA6U1T1hY4ANV8nBawsbJJKBC3Nb hhIAuDxdfhB+N58/nnKFGPbIiNjH2n3x/SE0QoXfiVdlzJIEWA Ju+4CXEB5EPg1G8yaL+BX3NTuVBJQmpzxBoeVpHimf69OwxZs8 24ykctF4k/zVOWRI/Rka46zWqsNqwuVO8qOiOq9Gr X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -6.9 (------) X-Debbugs-Envelope-To: submit Cc: Leo , Stefan Monnier 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: -6.9 (------) Am 17.05.2013 15:37, schrieb Leo Liu: > On 2013-05-17 21:28 +0800, Stefan Monnier wrote: >> I don't understand when that can happen (when inside a string (nth >> 8 ppss) is also non-nil). > > I have > > (defvar octave-comment-start-skip "\\(^\\|\\S<\\)\\(?:%!\\|\\s<+\\)\\s-*" > "Octave-specific `comment-start-skip' (which see).") > > and this could find "#abc" as comment start where BEG is outside of > strings and comments but END is in a string. > > Maybe this is due to setting octave-comment-start-skip incorrectly. > > I looked at comment-normalize-vars and see it uses: > > \\(\\(^\\|[^\\\n]\\)\\(\\\\\\\\\\)*\\) > > as anchor but I don't understand fully. > > Leo > > > > BTW what is the fastest way moving backward --searching comment-- when not inside a comment? Thought at (forward-line -1) (end-of-line) ppss-Check-for-Comment-again maybe re-search-backward is as fast? Andreas From debbugs-submit-bounces@debbugs.gnu.org Fri May 17 11:53:17 2013 Received: (at 14303) by debbugs.gnu.org; 17 May 2013 15:53:17 +0000 Received: from localhost ([127.0.0.1]:49165 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UdMy4-00044C-HV for submit@debbugs.gnu.org; Fri, 17 May 2013 11:53:17 -0400 Received: from chene.dit.umontreal.ca ([132.204.246.20]:53458) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UdMy0-00043w-Ax for 14303@debbugs.gnu.org; Fri, 17 May 2013 11:53:14 -0400 Received: from faina.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id r4HFqsNI013132; Fri, 17 May 2013 11:52:54 -0400 Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id B3B9EB4161; Fri, 17 May 2013 11:52:54 -0400 (EDT) From: Stefan Monnier To: Leo Liu Subject: Re: bug#14303: 24.3; Bug in comment-search-backward Message-ID: References: <5193B43B.8070007@easy-emacs.de> <519486DD.1040505@easy-emacs.de> Date: Fri, 17 May 2013 11:52:54 -0400 In-Reply-To: (Leo Liu's message of "Fri, 17 May 2013 21:37:25 +0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4582=0 X-NAI-Spam-Version: 2.3.0.9362 : core <4582> : streams <962436> : uri <1422823> X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: 14303 Cc: 14303@debbugs.gnu.org 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: -4.2 (----) >> I don't understand when that can happen (when inside a string (nth >> 8 ppss) is also non-nil). > I have > (defvar octave-comment-start-skip "\\(^\\|\\S<\\)\\(?:%!\\|\\s<+\\)\\s-*" > "Octave-specific `comment-start-skip' (which see).") > and this could find "#abc" as comment start where BEG is outside of > strings and comments but END is in a string. Ah, I see. That's easy to fix: just check the syntax-ppss state at the position about which you care, i.e. (or (match-end 1) (match-beginning 0)), rather than at the position at which re-search-backward puts you. > Maybe this is due to setting octave-comment-start-skip incorrectly. > I looked at comment-normalize-vars and see it uses: > \\(\\(^\\|[^\\\n]\\)\\(\\\\\\\\\\)*\\) > as anchor but I don't understand fully. No, this is to try and avoid mis-recognizing \# (and \\\#, but not \\#) as a comment starter when \ is an escape character. Stefan From debbugs-submit-bounces@debbugs.gnu.org Fri May 17 18:52:08 2013 Received: (at 14303) by debbugs.gnu.org; 17 May 2013 22:52:09 +0000 Received: from localhost ([127.0.0.1]:49570 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UdTVQ-0002iv-9z for submit@debbugs.gnu.org; Fri, 17 May 2013 18:52:08 -0400 Received: from mail-pb0-f50.google.com ([209.85.160.50]:36852) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UdTVM-0002iL-TI for 14303@debbugs.gnu.org; Fri, 17 May 2013 18:52:05 -0400 Received: by mail-pb0-f50.google.com with SMTP id wy17so775841pbc.37 for <14303@debbugs.gnu.org>; Fri, 17 May 2013 15:51:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:references:face:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=ai/RiE1kr1/kXflHw+Nm/UwrdAtfN4s174qmb6KAR3Y=; b=M5CPNi3rFbINNIRj92Mw/pikbyDqClVK+zhyJz/6D8wIo17zVG/R4uNIJfQPeGy/mK J0F79XLmE4nM6H08tSmMu3UmOXmxu+mZr8BFY0G2dvMknG61fMRsk3YX1z6H7CDL0KJ8 FYiPD2njAL+SlTbMFEJbIA/Z4Fom15muIMahhENev7DbBy1OxLY/PixtKTeb0tEYs7tZ KBHyOzuUepODEuINkTnd9gCuULvE8Ow3L/BVHl4sy8EgF6FSPAvtoQ0brY7ItZeuIwGG KxASmsncmHE7VC17Jp3+8OzTVe51vH2uUMTlm0J0s/xvm1AZ985JyDb1IQVsVVkaXqOW oKLQ== X-Received: by 10.66.230.199 with SMTP id ta7mr22837651pac.153.1368831100325; Fri, 17 May 2013 15:51:40 -0700 (PDT) Received: from Zeuss-MacBook.local (li511-224.members.linode.com. [66.175.216.224]) by mx.google.com with ESMTPSA id v7sm12849239pbq.32.2013.05.17.15.51.37 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 17 May 2013 15:51:39 -0700 (PDT) From: Leo Liu To: Stefan Monnier Subject: Re: bug#14303: 24.3; Bug in comment-search-backward References: Face: iVBORw0KGgoAAAANSUhEUgAAACkAAAApAQAAAACAGz1bAAABKElEQVQYlWNg3NIt5FDPUPt7 4+X79Qyucz5/ugik+L2PBgKpyphaIK921q23QDnG0NBQoMr/vaWl9f8ZLL78uPv5PwN7RETfzXoG jhmFz27XM0RXmpuY/WfY+fv0Mc56BvFybfXA/wwL5t/wF61n2PU59axXPcOVzbmSW/8zrNt1benC /ww70hqUU/4zKCtrT9jwn8FhwynbufUMendE2aLqGRpdX9al1zM8eh17lKeeQcTMrdD5P8P3j/YT Q/8zXHSb7p1Qz/C4OM2JuZ7hgtI7K6AjqsMnf8j4z8C6xG1tw3+GqpqvsVn/GTzmpD9j/8/wP/oZ S/l/Bka+QO/g/wy15ueeFQL9N1O8mPU/g+umV3t1gdT0/1bTgHLqYVeXAlWKpMWt+w8Az82C9nHf X0cAAAAASUVORK5CYII= Date: Sat, 18 May 2013 06:51:31 +0800 In-Reply-To: (Stefan Monnier's message of "Fri, 17 May 2013 09:26:37 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (OS X 10.8.3) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 14303 Cc: 14303@debbugs.gnu.org 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: -2.6 (--) On 2013-05-17 21:26 +0800, Stefan Monnier wrote: > BTW, a useful idiom for such loops is the "empty body" while loop. > > (while (and (re-search-backward comment-start-skip limit t) > (progn > (setq end (match-end 0)) > (and comment-use-syntax (nth 8 (syntax-ppss)))))) Yes, I use this occasionally too. Since we need to know if a comment start is found I don't use it here. Leo From debbugs-submit-bounces@debbugs.gnu.org Fri May 17 18:53:41 2013 Received: (at submit) by debbugs.gnu.org; 17 May 2013 22:53:41 +0000 Received: from localhost ([127.0.0.1]:49576 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UdTWt-0002m5-1L for submit@debbugs.gnu.org; Fri, 17 May 2013 18:53:41 -0400 Received: from eggs.gnu.org ([208.118.235.92]:60416) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UdTWr-0002ls-Ec for submit@debbugs.gnu.org; Fri, 17 May 2013 18:53:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UdTWP-0003Lv-NE for submit@debbugs.gnu.org; Fri, 17 May 2013 18:53:14 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-102.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW,T_DKIM_INVALID,USER_IN_WHITELIST autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:56126) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UdTWP-0003Lf-Jk for submit@debbugs.gnu.org; Fri, 17 May 2013 18:53:09 -0400 Received: from eggs.gnu.org ([208.118.235.92]:43500) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UdTWL-00071Y-4t for bug-gnu-emacs@gnu.org; Fri, 17 May 2013 18:53:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UdTWG-0003Ca-8l for bug-gnu-emacs@gnu.org; Fri, 17 May 2013 18:53:05 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:48560) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UdTWG-0003CL-3f for bug-gnu-emacs@gnu.org; Fri, 17 May 2013 18:53:00 -0400 Received: by mail-pa0-f47.google.com with SMTP id kl13so3970147pab.6 for ; Fri, 17 May 2013 15:52:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:references:face:date:in-reply-to :message-id:user-agent:mime-version:content-type :content-transfer-encoding; bh=qaXpeTgyJkZPF81+sfxFVhDkMLvHRZNBm/T78HI7ty4=; b=WDlA7zhjdVGPqhnYHj17k2O7snY8U/uzRBmXDXyVImNWFyzOfrcVE4BasZOycgh+qy U4B93kxID4RMN+Jxh0QVNh4U1DJ6DmgsVQIjxSwyRHzEJNLY7tHNrhJxuUV3o5Esxxh/ mb24S1yFKyNzYYxQSRtNkpOV6IUMO0GHqPN5kBegpwExrCQ7HSSmYrLtEmKNP3Ise1nT 3PV1hVvtwEyEQhoAHwOzCQ0AvAxXNDMWEEg2qoMU+hxkFuhuvSuDDDSsdwL38n4S6YmB O8Oxm2euJRWoWe+Az3fkYEMKt54k1FpmHRBMzciydwLzREASbKw516/7PnLyppLtDTPj +wQg== X-Received: by 10.66.74.170 with SMTP id u10mr51579507pav.202.1368831179191; Fri, 17 May 2013 15:52:59 -0700 (PDT) Received: from Zeuss-MacBook.local (li511-224.members.linode.com. [66.175.216.224]) by mx.google.com with ESMTPSA id al2sm12862452pbc.25.2013.05.17.15.52.56 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 17 May 2013 15:52:58 -0700 (PDT) From: Leo Liu To: Andreas =?iso-8859-1?Q?R=F6hler?= Subject: Re: bug#14303: 24.3; Bug in comment-search-backward References: <5193B43B.8070007@easy-emacs.de> <519486DD.1040505@easy-emacs.de> <51963E40.9020202@easy-emacs.de> Face: iVBORw0KGgoAAAANSUhEUgAAACgAAAAoBAMAAAB+0KVeAAAAGFBMVEUKDAg1NjRWV1V9fnyg op/DxcLk5uP8/voi63ReAAAACXBIWXMAAAWJAAAFiQFtaJ36AAAAB3RJTUUH1goZAgAz00bgXgAA AeVJREFUKM9lk0Fz2jAQhQXJD3CCO70CmcC1YMtcWyTZ14Bl69xats4N9r6/3zWQBlodNKNPu/s0 b1cCQFuZGpfVVh3vAvBJolIXRkapSuoRUtIdFyo1Y5xSdlAj7OtvD1XnXxmWRi+eWgcxyCed1lVV B1CrKyujMoi+eLA5kU1SsjoHlW+nQjTtFxk4MXgrOxvIqzoTZR8XgPaLl419zgsMaSGFPiUOZCIh thsx5Xy9NsK8Kwf/JoQgMxcVJ301HKkcSWaT0O7FY056J4U9xcYfnmVXG4801lW6lqwu2nKFZoHC HuzvaTVndZ+LaRQgZdthXw1cpynEkLEwyFHXk/aIxNQ6QeooJuzPMB+wn+D7JJNsiCcVA13/A3h/ xE9J+WidpAwoYNmRFwyvSRhNVtsdaAewzZZP5uw82QL9+tyNfocyP0McAzICUr5Mk9RdIjWasUNx aIIt6NK4ZtXIMdfMQt3nuMAyWbLI4DqZ4xPq/ag8jPond4XU/cLuOgw6XCFX/YCUfcDAMMH58fD4 G9kDchwfqVefkBwup2uZM+Q4WhJt5jN3AxXCsaS2yXEDuWgS8VOzW0gFjhEPmLyFMKBFaLb1HRwc DiaKwx0EeTMRYnYPQRW3PP4HApvlMv0PttX5v/D6Aws3IOSEwzmLAAAAAElFTkSuQmCC Date: Sat, 18 May 2013 06:52:52 +0800 In-Reply-To: <51963E40.9020202@easy-emacs.de> ("Andreas \=\?iso-8859-1\?Q\?R\?\= \=\?iso-8859-1\?Q\?\=F6hler\=22's\?\= message of "Fri, 17 May 2013 16:27:12 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (OS X 10.8.3) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -6.1 (------) X-Debbugs-Envelope-To: submit Cc: bug-gnu-emacs@gnu.org 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: -6.1 (------) On 2013-05-17 22:27 +0800, Andreas R=F6hler wrote: > maybe re-search-backward is as fast? Usually it is fast enough. I have experienced some slow cases in C-x [ but maybe that is due to really bad regexp. Leo From debbugs-submit-bounces@debbugs.gnu.org Fri May 17 18:55:20 2013 Received: (at 14303-done) by debbugs.gnu.org; 17 May 2013 22:55:20 +0000 Received: from localhost ([127.0.0.1]:49582 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UdTYV-0002pz-Do for submit@debbugs.gnu.org; Fri, 17 May 2013 18:55:19 -0400 Received: from mail-pb0-f48.google.com ([209.85.160.48]:56911) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UdTYS-0002pc-A2 for 14303-done@debbugs.gnu.org; Fri, 17 May 2013 18:55:17 -0400 Received: by mail-pb0-f48.google.com with SMTP id md12so1027518pbc.7 for <14303-done@debbugs.gnu.org>; Fri, 17 May 2013 15:54:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:references:face:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=feNVaUaoMiDPm4rdB+4WpojcyIwfo7U1G2R2qXw+w6E=; b=hybtaqd6K1wMN1F162X0soBDB2j/peGS4p7yIYVItxYjFWNLRv0k6gAttkH9jjU/O1 J5An0kugTunI/XGu7BO7OFar4gBmzZSaBd46uilmPqr8FL1kapoZ4/9L3hJuTGz/LuQj HTtH+XhD4+vbdFCfr36LojQ1ZIpjKaXOyaqMHYp3NQOlhoYeoD+vZs46Gt3f2QYWihiX +W5o806ZwWdTTqkV5ZVamLJqZo5KK12pVXO7ZbQoqc7nva/1jK5hRwHQnmjbw/kCeXFG JBhuy7OBydzJzKcQVGbgNTHNcJuZibHe/J7rgecvmhvqfNVleHnBssr3PLyIH+t4Ogj/ Op9g== X-Received: by 10.66.248.40 with SMTP id yj8mr50168454pac.95.1368831292432; Fri, 17 May 2013 15:54:52 -0700 (PDT) Received: from Zeuss-MacBook.local (li511-224.members.linode.com. [66.175.216.224]) by mx.google.com with ESMTPSA id dr6sm13972072pac.11.2013.05.17.15.54.50 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 17 May 2013 15:54:51 -0700 (PDT) From: Leo Liu To: Stefan Monnier Subject: Re: bug#14303: 24.3; Bug in comment-search-backward References: <5193B43B.8070007@easy-emacs.de> <519486DD.1040505@easy-emacs.de> Face: iVBORw0KGgoAAAANSUhEUgAAACkAAAApAQAAAACAGz1bAAABKElEQVQYlWNg3NIt5FDPUPt7 4+X79Qyucz5/ugik+L2PBgKpyphaIK921q23QDnG0NBQoMr/vaWl9f8ZLL78uPv5PwN7RETfzXoG jhmFz27XM0RXmpuY/WfY+fv0Mc56BvFybfXA/wwL5t/wF61n2PU59axXPcOVzbmSW/8zrNt1benC /ww70hqUU/4zKCtrT9jwn8FhwynbufUMendE2aLqGRpdX9al1zM8eh17lKeeQcTMrdD5P8P3j/YT Q/8zXHSb7p1Qz/C4OM2JuZ7hgtI7K6AjqsMnf8j4z8C6xG1tw3+GqpqvsVn/GTzmpD9j/8/wP/oZ S/l/Bka+QO/g/wy15ueeFQL9N1O8mPU/g+umV3t1gdT0/1bTgHLqYVeXAlWKpMWt+w8Az82C9nHf X0cAAAAASUVORK5CYII= Date: Sat, 18 May 2013 06:54:46 +0800 In-Reply-To: (Stefan Monnier's message of "Fri, 17 May 2013 11:52:54 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (OS X 10.8.3) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 14303-done Cc: 14303-done@debbugs.gnu.org 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: -2.6 (--) Fixed in trunk. On 2013-05-17 23:52 +0800, Stefan Monnier wrote: > Ah, I see. That's easy to fix: just check the syntax-ppss state at the > position about which you care, i.e. (or (match-end 1) (match-beginning 0)), > rather than at the position at which re-search-backward puts you. Thanks a lot. Leo From debbugs-submit-bounces@debbugs.gnu.org Sat May 18 01:21:39 2013 Received: (at submit) by debbugs.gnu.org; 18 May 2013 05:21:39 +0000 Received: from localhost ([127.0.0.1]:49815 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UdZaM-00032M-MK for submit@debbugs.gnu.org; Sat, 18 May 2013 01:21:39 -0400 Received: from eggs.gnu.org ([208.118.235.92]:40302) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UdZaI-00031y-Gj for submit@debbugs.gnu.org; Sat, 18 May 2013 01:21:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UdZZs-0000NZ-RY for submit@debbugs.gnu.org; Sat, 18 May 2013 01:21:09 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-101.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, USER_IN_WHITELIST autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:44791) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UdZZs-0000NV-OJ for submit@debbugs.gnu.org; Sat, 18 May 2013 01:21:08 -0400 Received: from eggs.gnu.org ([208.118.235.92]:51662) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UdZZr-0004jl-1f for bug-gnu-emacs@gnu.org; Sat, 18 May 2013 01:21:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UdZZq-0000NE-5U for bug-gnu-emacs@gnu.org; Sat, 18 May 2013 01:21:06 -0400 Received: from moutng.kundenserver.de ([212.227.126.186]:52769) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UdZZp-0000NA-SR for bug-gnu-emacs@gnu.org; Sat, 18 May 2013 01:21:06 -0400 Received: from [192.168.178.21] (brln-4db9aa50.pool.mediaWays.net [77.185.170.80]) by mrelayeu.kundenserver.de (node=mreu1) with ESMTP (Nemesis) id 0LlJ5u-1U2r732Dgs-00bHY4; Sat, 18 May 2013 07:21:03 +0200 Message-ID: <51971055.3080102@easy-emacs.de> Date: Sat, 18 May 2013 07:23:33 +0200 From: =?ISO-8859-1?Q?Andreas_R=F6hler?= User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: Leo Liu Subject: Re: bug#14303: 24.3; Bug in comment-search-backward References: <5193B43B.8070007@easy-emacs.de> <519486DD.1040505@easy-emacs.de> <51963E40.9020202@easy-emacs.de> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Provags-ID: V02:K0:3qsSaFvyiHoQT59agxXaKB4WvTnbzjVvYDvKjZVkoBl dosXeDrwTR0nCxgK7izMA3pLN7oouFR36ZhUSS4sK9Wz9Y6Mmp HpRgc9KrKfDf2CCDnqPPs9hO+FXad4GsguxmV3xo4ywkXeqvJL AiOASZr5sLmb995ja9BmrRmV1sI9QM2nj9UOYn5xVC7NZ+icug ZmFpzRxz/bfI6p5BYzLyWT7JC3cbefK5lrkFnjnz78ovhhCNGb AtFmrgNQFgVmsnDsgYlK+redSJCQb2nBkjFFEpb8bjUSMB1EJi 2qg75AdGrg4I3A1Ob/qXNpJIL+UZTMUxpU7gT0HU+HPHY2O/DS sEGXJNuxfaJ2Bhu33mM6rHdztkdFxLZFhsr92ly0H X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit Cc: bug-gnu-emacs@gnu.org 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: -6.9 (------) Am 18.05.2013 00:52, schrieb Leo Liu: > On 2013-05-17 22:27 +0800, Andreas Röhler wrote: >> maybe re-search-backward is as fast? > > Usually it is fast enough. I have experienced some slow cases in C-x [ > but maybe that is due to really bad regexp. > > Leo > As this is a very basic routine, IMO every thinking to make it as fast as possible is well invested. BTW it's your merit having addressed that item. So just for the record maybe: Why start searching backward with a re-? Why not search comment-start string, which should travel much faster? Andreas From debbugs-submit-bounces@debbugs.gnu.org Mon May 20 21:56:21 2013 Received: (at 14303) by debbugs.gnu.org; 21 May 2013 01:56:22 +0000 Received: from localhost ([127.0.0.1]:53682 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UeboJ-0002TA-FL for submit@debbugs.gnu.org; Mon, 20 May 2013 21:56:21 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:21556) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UeboF-0002Sm-NQ for 14303@debbugs.gnu.org; Mon, 20 May 2013 21:56:16 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFFFpZoF/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLNBIUGA0kiB4GwS2RCgOkeoFegxM X-IPAS-Result: Av4EABK/CFFFpZoF/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLNBIUGA0kiB4GwS2RCgOkeoFegxM X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="13747323" Received: from 69-165-154-5.dsl.teksavvy.com (HELO pastel.home) ([69.165.154.5]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 20 May 2013 21:55:28 -0400 Received: by pastel.home (Postfix, from userid 20848) id 19E0B67A3C; Mon, 20 May 2013 21:55:33 -0400 (EDT) From: Stefan Monnier To: Andreas =?iso-8859-1?Q?R=F6hler?= Subject: Re: bug#14303: 24.3; Bug in comment-search-backward Message-ID: References: <5193B43B.8070007@easy-emacs.de> <519486DD.1040505@easy-emacs.de> <51963E40.9020202@easy-emacs.de> <51971055.3080102@easy-emacs.de> Date: Mon, 20 May 2013 21:55:33 -0400 In-Reply-To: <51971055.3080102@easy-emacs.de> ("Andreas =?iso-8859-1?Q?R?= =?iso-8859-1?Q?=F6hler=22's?= message of "Sat, 18 May 2013 07:23:33 +0200") 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.5 (/) X-Debbugs-Envelope-To: 14303 Cc: 14303@debbugs.gnu.org, Leo Liu 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: -1.9 (-) > Why start searching backward with a re-? Why not search comment-start > string, which should travel much faster? Fast is good, but that would be simply wrong. Stefan From debbugs-submit-bounces@debbugs.gnu.org Wed May 22 06:56:27 2013 Received: (at 14303) by debbugs.gnu.org; 22 May 2013 10:56:27 +0000 Received: from localhost ([127.0.0.1]:55969 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Uf6iX-0002PR-9D for submit@debbugs.gnu.org; Wed, 22 May 2013 06:56:26 -0400 Received: from moutng.kundenserver.de ([212.227.126.186]:54654) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Uf6iR-0002Ol-R3 for 14303@debbugs.gnu.org; Wed, 22 May 2013 06:56:21 -0400 Received: from [192.168.178.21] (brln-4db9ef0f.pool.mediaWays.net [77.185.239.15]) by mrelayeu.kundenserver.de (node=mreu3) with ESMTP (Nemesis) id 0LvdiS-1UOWl03swm-017Xcl; Wed, 22 May 2013 12:55:27 +0200 Message-ID: <519CA4BF.3040206@easy-emacs.de> Date: Wed, 22 May 2013 12:58:07 +0200 From: =?ISO-8859-15?Q?Andreas_R=F6hler?= User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: Stefan Monnier Subject: Re: bug#14303: 24.3; Bug in comment-search-backward References: <5193B43B.8070007@easy-emacs.de> <519486DD.1040505@easy-emacs.de> <51963E40.9020202@easy-emacs.de> <51971055.3080102@easy-emacs.de> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:8zQrIQrlM4hez9pnpU5tmp/Oc9MkpNeevCetKhiF00i YaQ7EirTGPi2ja9AfcDINMNQXiAAK9Yw41vzNG1JGa1Cm0HD0/ 1ld1P3VM5vmuZoCqC8OLKfGnbhsxqI6q+5dSh0VYBKgElqhQdG MMNXjDdv8V/EfF44U3mTLoIspCnMZnAheBP9qTz6KyOkRFwGbC F7ncrCnTActp+KU81YajHQZ42c4ngt/+I0gZsyiYXcNM9N9ZTQ +wcccvDF0mchOQjedGGdQZgSDLwax4cWzBK1xF14FwYr1fMpkc fhF2LJFGnfz9ymtyQWgfYxJlS7QGOo3AbY2S0Sl6Zb1GWBw2pH 5wKL3iow/pyMIABcpBL/0Y3iOzAKa8OTluz+CYPef X-Spam-Score: 0.8 (/) X-Debbugs-Envelope-To: 14303 Cc: 14303@debbugs.gnu.org, Leo Liu 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: -1.9 (-) Am 21.05.2013 03:55, schrieb Stefan Monnier: >> Why start searching backward with a re-? Why not search comment-start >> string, which should travel much faster? > > Fast is good, but that would be simply wrong. > > > Stefan > May you point me at a use-case, where comment-start-skip as regexp is needed? I.e. a case where comment-start as string wouldn't do it. Thanks, Andreas From debbugs-submit-bounces@debbugs.gnu.org Wed May 22 11:59:43 2013 Received: (at 14303) by debbugs.gnu.org; 22 May 2013 15:59:43 +0000 Received: from localhost ([127.0.0.1]:56461 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UfBS2-0000y0-Qi for submit@debbugs.gnu.org; Wed, 22 May 2013 11:59:42 -0400 Received: from relais.videotron.ca ([24.201.245.36]:34434) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UfBS0-0000xp-Q1 for 14303@debbugs.gnu.org; Wed, 22 May 2013 11:59:41 -0400 MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII Received: from ceviche.home ([184.163.196.74]) by VL-VM-MR003.ip.videotron.ca (Oracle Communications Messaging Exchange Server 7u4-22.01 64bit (built Apr 21 2011)) with ESMTP id <0MN700HFXJ27J2I0@VL-VM-MR003.ip.videotron.ca> for 14303@debbugs.gnu.org; Wed, 22 May 2013 11:58:55 -0400 (EDT) Received: by ceviche.home (Postfix, from userid 20848) id 23D3466107; Wed, 22 May 2013 11:58:55 -0400 (EDT) From: Stefan Monnier To: Andreas =?iso-8859-1?Q?R=F6hler?= Subject: Re: bug#14303: 24.3; Bug in comment-search-backward Message-id: References: <5193B43B.8070007@easy-emacs.de> <519486DD.1040505@easy-emacs.de> <51963E40.9020202@easy-emacs.de> <51971055.3080102@easy-emacs.de> <519CA4BF.3040206@easy-emacs.de> Date: Wed, 22 May 2013 11:58:55 -0400 In-reply-to: <519CA4BF.3040206@easy-emacs.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-Spam-Score: -1.2 (-) X-Debbugs-Envelope-To: 14303 Cc: 14303@debbugs.gnu.org, Leo Liu 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: -1.2 (-) > May you point me at a use-case, where comment-start-skip as regexp is needed? > I.e. a case where comment-start as string wouldn't do it. E.g. in C++, comment-start is typically "//" which won't find the beginning of a /*...*/ comment. Stefan From debbugs-submit-bounces@debbugs.gnu.org Wed May 22 12:51:27 2013 Received: (at 14303) by debbugs.gnu.org; 22 May 2013 16:51:27 +0000 Received: from localhost ([127.0.0.1]:56531 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UfCG7-0002gU-5o for submit@debbugs.gnu.org; Wed, 22 May 2013 12:51:27 -0400 Received: from moutng.kundenserver.de ([212.227.126.186]:63791) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UfCG4-0002g8-44 for 14303@debbugs.gnu.org; Wed, 22 May 2013 12:51:25 -0400 Received: from [192.168.178.21] (brln-4db9ef0f.pool.mediaWays.net [77.185.239.15]) by mrelayeu.kundenserver.de (node=mreu4) with ESMTP (Nemesis) id 0LkWsS-1U4l1u12Mm-00aqwr; Wed, 22 May 2013 18:50:30 +0200 Message-ID: <519CF7F7.5090502@easy-emacs.de> Date: Wed, 22 May 2013 18:53:11 +0200 From: =?ISO-8859-1?Q?Andreas_R=F6hler?= User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: Stefan Monnier Subject: Re: bug#14303: 24.3; Bug in comment-search-backward References: <5193B43B.8070007@easy-emacs.de> <519486DD.1040505@easy-emacs.de> <51963E40.9020202@easy-emacs.de> <51971055.3080102@easy-emacs.de> <519CA4BF.3040206@easy-emacs.de> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:bK90DrDaoxMDygIiVXTHppU/L+NDJfajnydvD5DsKPe yz9oujAJxgsCwtcn/tgdeSNEZvQANeHRgJ4aZcyeRdh6OIr2g6 WrtTNSQRNZImHyzfP004CWy+zGWCFXjSk3Qgd+TsX9BR3wLA/J 7yKnRM9ea3kFrYQtEVBAeZc8dEp4u6fvvOhsH0yDHqUtVT+p4f M7A6YwGeL+1e7fHpT1lbcUOIyKmwSO4WihPTBTV6o7med3zKjQ eOEAE+CAq3DBzv1Q+GZUFZWX++E4lxxnJzxAFX9d/oxp1S4PC9 3PDw5X1ZtVkM1KQlWtUXI7SvM11Jf94bPMxXeNbl0wgy8F+qgg UvvePv2c2B7oJjX+AozHolJJ2JcGLu+Pe0uvLv0aG X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 14303 Cc: 14303@debbugs.gnu.org, Leo Liu 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: -1.9 (-) Am 22.05.2013 17:58, schrieb Stefan Monnier: >> May you point me at a use-case, where comment-start-skip as regexp is needed? >> I.e. a case where comment-start as string wouldn't do it. > > E.g. in C++, comment-start is typically "//" which won't find the > beginning of a /*...*/ comment. > > > Stefan > Okay, see. Thanks. With different ways to start a comment, the regexp seems inevitable. However, emacs lisp and related should not need it. Given it's not defined if not needed, the backward-search could speed up in this cases. Andreas From unknown Tue Jun 24 17:28:16 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 20 Jun 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