From unknown Sat Jun 21 10:27:36 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#11025 <11025@debbugs.gnu.org> To: bug#11025 <11025@debbugs.gnu.org> Subject: Status: 23.1; re-search-backward does not find the right beginning of the regexp Reply-To: bug#11025 <11025@debbugs.gnu.org> Date: Sat, 21 Jun 2025 17:27:36 +0000 retitle 11025 23.1; re-search-backward does not find the right beginning of= the regexp reassign 11025 emacs submitter 11025 Jack Duthen severity 11025 minor tag 11025 notabug thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 16 12:49:51 2012 Received: (at submit) by debbugs.gnu.org; 16 Mar 2012 16:49:51 +0000 Received: from localhost ([127.0.0.1]:53674 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S8aLU-0005sE-64 for submit@debbugs.gnu.org; Fri, 16 Mar 2012 12:49:51 -0400 Received: from eggs.gnu.org ([208.118.235.92]:35240) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S8W0O-0007y6-JD for submit@debbugs.gnu.org; Fri, 16 Mar 2012 08:11:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S8VX3-00028d-BZ for submit@debbugs.gnu.org; Fri, 16 Mar 2012 07:41:23 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:43484) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S8VX3-00028Y-6E for submit@debbugs.gnu.org; Fri, 16 Mar 2012 07:41:17 -0400 Received: from eggs.gnu.org ([208.118.235.92]:45054) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S8VWw-0001CM-QS for bug-gnu-emacs@gnu.org; Fri, 16 Mar 2012 07:41:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S8VWX-00025D-Fg for bug-gnu-emacs@gnu.org; Fri, 16 Mar 2012 07:41:10 -0400 Received: from mail-yw0-f41.google.com ([209.85.213.41]:49802) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S8VWX-00024t-71 for bug-gnu-emacs@gnu.org; Fri, 16 Mar 2012 07:40:45 -0400 Received: by yhr47 with SMTP id 47so4920205yhr.0 for ; Fri, 16 Mar 2012 04:40:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:from:date:x-google-sender-auth:message-id :subject:to:content-type:content-transfer-encoding; bh=Xj2W7aktBNycTMIPTZpAZAQ9H+w7ZajCFRZ5ir8ZDTo=; b=iSS150MbIguSouAVLPToL3x/qD3SP4mLmu5LFQoHlsqcgZYGURAG/+jXGpSiuMfv2L wWGOPNnvjxoBH7CeWvbvYmxPUmSj5Qds2uhPsNr5XqGx4+aQ4yMuPFoFZNGJIu36q5wx QAZDguLGwEQx5884HBWRY7OtNXGuQRLrgdgXg/tTTtFenm2MVdR9+kc+CjEfh9zHkfNt f3olFAeq6x5FCy260E7CGeUlLl1YWNwWEY/NIpT1XZUxx8VfczghfiwiIPPaz5LTpbsj 6PL0ZsGlIYoo5qqQXMgfGqBI+l07e/r0FITIhWyJszAVbEPuhsdC6FAQy88n5qeoeoG8 qWkg== Received: by 10.60.22.233 with SMTP id h9mr2790250oef.30.1331898042250; Fri, 16 Mar 2012 04:40:42 -0700 (PDT) MIME-Version: 1.0 Received: by 10.182.171.97 with HTTP; Fri, 16 Mar 2012 04:40:22 -0700 (PDT) From: Jack Duthen Date: Fri, 16 Mar 2012 12:40:22 +0100 X-Google-Sender-Auth: _4mc1XdoWyw7wlbEghz2PhjmcNs Message-ID: Subject: 23.1; re-search-backward does not find the right beginning of the regexp To: bug-gnu-emacs@gnu.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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 (newer, 3) X-Received-From: 208.118.235.17 X-Spam-Score: -6.1 (------) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Fri, 16 Mar 2012 12:49:38 -0400 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 (------) --text follows this line-- Hello, I'm editing a ".el" file, in emacs-lisp-mode, and I use the standard value of `comment-start-skip': ;;; (insert comment-start-skip) "\(\(^\|[^\\ ]\)\(\\\\\)*\);+ *"=A0 <-- I added the quotes here ;;; Test #1 ;;; (progn (beginning-of-line) (looking-at comment-start-skip)) ;;; Move the point at the end of the previous line and type C-x C-e ;;; It moves the point at the beginning of the line and returns T. Ok. ;;; (progn (previous-line) (re-search-forward comment-start-skip)) ;;; Move the point at the end of the previous line and type C-x C-e ;;; It moves the point on the first "(". Ok. ;;; Thus the string "^;;; " matches the regexp `comment-start-skip'. ;;; (re-search-backward comment-start-skip) ;;; Move the point at the end of the previous line and type C-x C-e ;;; It moves the point just one character AFTER the first semicolon. ;;; I would expect it to move the point at the beginning of the line ;;; since, as shown previously, it matches the regexp and this match ;;; includes the match actually found. ;;; Test #2 ; (setq re1 (concat comment-start-skip "--+\n" comment-start-skip " [^ ].*\= n")) ; (setq re (concat "\\(" re1 "\\)+")) ; Move the point at the end of the next line and type C-x C-e to see the ma= tch ; (progn (forward-char) (and (looking-at re) (re-search-forward re))) ; ---------- ; this yes ; ---------- ; this no ; ---------- ; ; (re-search-backward re) ; Move the point at the end of the previous line and type C-x C-e ; The point moves to the beginning of the line before "this no". ; =3D> Bug In GNU Emacs 23.1.1 (i686-pc-linux-gnu, GTK+ Version 2.22.0) =A0of 2011-03-04 on roseapple, modified by Debian Windowing system distributor `The X.Org Foundation', version 11.0.10900000 configured using `configure=A0 '--build=3Di686-linux-gnu' '--host=3Di686-linux-gnu' '--prefix=3D/usr' '--sharedstatedir=3D/var/lib' '--libexecdir=3D/usr/lib' '--localstatedir=3D/var/lib' '--infodir=3D/usr/share/info' '--mandir=3D/usr/share/man' '--with-pop=3Dyes= ' '--enable-locallisppath=3D/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23= .1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.1/site-li= sp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.1/leim' '--with-x=3Dyes' '--with-x-toolkit=3Dgtk' '--with-toolkit-scroll-bars' 'build_alias=3Di686-linux-gnu' 'host_alias=3Di686-linux-gnu' 'CFLAGS=3D-DDEBIAN -g -O2' 'LDFLAGS=3D-g' 'CPPFLAGS=3D'' Important settings: =A0 value of $LC_ALL: nil =A0 value of $LC_COLLATE: nil =A0 value of $LC_CTYPE: nil =A0 value of $LC_MESSAGES: nil =A0 value of $LC_MONETARY: nil =A0 value of $LC_NUMERIC: nil =A0 value of $LC_TIME: nil =A0 value of $LANG: fr_FR.utf8 =A0 value of $XMODIFIERS: nil =A0 locale-coding-system: utf-8-unix =A0 default-enable-multibyte-characters: t Major mode: Emacs-Lisp Minor modes in effect: =A0 which-function-mode: t =A0 diff-auto-refine-mode: t =A0 eldoc-mode: t =A0 show-paren-mode: t =A0 recentf-mode: t =A0 desktop-save-mode: t =A0 tooltip-mode: t =A0 mouse-wheel-mode: t =A0 menu-bar-mode: t =A0 file-name-shadow-mode: t =A0 global-font-lock-mode: t =A0 font-lock-mode: t =A0 blink-cursor-mode: t =A0 global-auto-composition-mode: t =A0 auto-composition-mode: t =A0 auto-encryption-mode: t =A0 auto-compression-mode: t =A0 column-number-mode: t =A0 line-number-mode: t =A0 transient-mark-mode: t Recent input: Recent messages: /usr/bin/mail is not an executable.=A0 Setting mail-interactive to t. )jack( From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 16 13:00:09 2012 Received: (at 11025) by debbugs.gnu.org; 16 Mar 2012 17:00:09 +0000 Received: from localhost ([127.0.0.1]:53688 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S8aVc-00068b-JJ for submit@debbugs.gnu.org; Fri, 16 Mar 2012 13:00:09 -0400 Received: from mail-gx0-f172.google.com ([209.85.161.172]:48707) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S8aVP-00067G-Me for 11025@debbugs.gnu.org; Fri, 16 Mar 2012 13:00:06 -0400 Received: by ggmi1 with SMTP id i1so4268108ggm.3 for <11025@debbugs.gnu.org>; Fri, 16 Mar 2012 09:29:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:content-type :content-transfer-encoding; bh=fAlN8UMtH5JR3NQq2h7s2vZqEtpXHjadw9eMcZzeuS8=; b=vmsvYQIdda5DxDBGCCWZcJDKSb39BkkYIe9faeKYMc0G4TSrb3yj2SCtU6KGJ/aNDE zHJOQy+0B608r7w9nD9TJpsubvQGh3HAhHJL75xjz5oyeHn2TbQG4lmeW01pAa8lJj5W 5AenuUeDBey/QpWcSqD3C6JcfTS39doRrt+u2MW4c+Rn3Qt79dBuUXBIkePLh7BDr+SM MYKOPyHs1stJ25ksIfaWUBUZa8H1HuD2Y1kkCR+lp7GiKBq3dMaS6rN2YH1eQa3uYLaW qEus9SGUqOgzkfJS1EIjLkgNzgR5jeuUKzm/GAu9fXkOXlacM7VQCwf/mgZI4V8VQquA EgLw== Received: by 10.60.22.233 with SMTP id h9mr3997739oef.30.1331915380662; Fri, 16 Mar 2012 09:29:40 -0700 (PDT) MIME-Version: 1.0 Received: by 10.182.171.97 with HTTP; Fri, 16 Mar 2012 09:29:20 -0700 (PDT) In-Reply-To: References: From: Jack Duthen Date: Fri, 16 Mar 2012 17:29:20 +0100 X-Google-Sender-Auth: hYdT2kM8V1CGT_cMQtIDBxsyZgw Message-ID: Subject: Fwd: bug#9681: Broken behaviour of re-search-backward (.+ matching only a single character) To: 11025@debbugs.gnu.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 11025 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 (--) Oops! It's a feature, not a bug... Sorry for the noise. I just found the same problem addressed in bug#9681. I understood the current behavior of re-search-backward. see my reply. sincerely )jack( ---------- Forwarded message ---------- From: Jack Duthen Date: 2012/3/16 Subject: Re: bug#9681: Broken behaviour of re-search-backward (.+ matching only a single character) To: bug-gnu-emacs@gnu.org On Thu, Oct 06, 2011 at 08:57:09AM -0400, Stefan Monnier wrote: > re-search-* stops at the first character position that has a match. > And then it chooses the longest match at that position. Stepan wrote: > So, again: it definitely needs better documentation, > and IMO it also needs fixing. Hi! For my own imenu-prev-index-position-function, I needed a backward regexp search which would match something like ".+" the way one (like Stepan) can expect rather than the way it actually does (as described by Stefan). So, I just wrote a function to do that. The way it handles the COUNT variable is not as good as one could want but, as I almost never use it, I don't care. It's not very efficient but, since I can't notice the time it takes when used in the "*rescan" menu and since I can't imagine a better algorith= m, it's ok for me. (defun jd-re-search-backward (regexp &optional bound noerror count) =A0(let ((orig-point (point)) bom) =A0 =A0(when (re-search-backward regexp bound noerror count) =A0 =A0 =A0(setq bom (point)) ; should not be useful =A0 =A0 =A0(goto-char (point-min)) =A0 =A0 =A0(while (re-search-forward regexp orig-point 'noerror) =A0 =A0 =A0 =A0;; remember the last beginning of match =A0 =A0 =A0 =A0(setq bom (match-beginning 0))) =A0 =A0 =A0(goto-char bom) =A0 =A0 =A0;; set match data (erased by the last failing search) and return= T =A0 =A0 =A0(looking-at regexp)))) HTH )jack( From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 16 13:48:23 2012 Received: (at control) by debbugs.gnu.org; 16 Mar 2012 17:48:23 +0000 Received: from localhost ([127.0.0.1]:53713 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S8bGJ-0007Gi-D2 for submit@debbugs.gnu.org; Fri, 16 Mar 2012 13:48:23 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:47403) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S8bG8-0007GO-8B for control@debbugs.gnu.org; Fri, 16 Mar 2012 13:48:22 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1S8amq-0002tZ-84 for control@debbugs.gnu.org; Fri, 16 Mar 2012 13:17:56 -0400 Date: Fri, 16 Mar 2012 13:17:56 -0400 Message-Id: Subject: control message for bug 11025 To: X-Mailer: mail (GNU Mailutils 2.1) From: Glenn Morris X-Spam-Score: -6.9 (------) X-Debbugs-Envelope-To: control 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 (------) forcemerge 9681 11025 From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 28 21:18:42 2016 Received: (at control) by debbugs.gnu.org; 29 Oct 2016 01:18:42 +0000 Received: from localhost ([127.0.0.1]:34363 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c0IIE-0005cQ-H3 for submit@debbugs.gnu.org; Fri, 28 Oct 2016 21:18:42 -0400 Received: from mail-it0-f54.google.com ([209.85.214.54]:38727) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c0IID-0005cB-NF for control@debbugs.gnu.org; Fri, 28 Oct 2016 21:18:42 -0400 Received: by mail-it0-f54.google.com with SMTP id q124so7548647itd.1 for ; Fri, 28 Oct 2016 18:18:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=kINRb5hUqdiVE1lGU+PIDif5fQAx8LuN6Mbks1Y0I7M=; b=pifGr6Y6CErn+vdDLJtLQH4Rsw5S1FNsPii1bMLnY9OK4w0beyCAsIp9xgFZpnpq+t zuH9b7V9R+A+C+NAkKNeqG6ACHMTNOtiB1c+P3Ak+q3uAEclc7TY5A9E5tJJZq77Zp5r BPp2jtJKFJvfofrmXolGV4emj/Zr5Q9KAPh9lr3+QXyUWWKVtkfmqJeRuKqjGha1HyW4 EFj7oYwDU3GV6rGYESe/xLqTdDLoXtKE3XOCGG6EL1XXZduVnvz1pncafDQLKObrGb/v DVsgOG3HpEvN2m6sZioWL9JsaEJ+L+eV5zzNMynXcAt2Ia/EZLblh4CzpAmhyEhuVCJO 8Rcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=kINRb5hUqdiVE1lGU+PIDif5fQAx8LuN6Mbks1Y0I7M=; b=iVZDlvJJL+tdnFNbE6Im7bHtlon2HjwqQ825BtcDrq3y+dOckjDF5ff6SI5zAAfmg/ MR8YRyE0ABlP8Z+hdRoU+a/R401uq86F1yNO/SkUGiXsqH0EKJ5l8UWdXYb/Md5O483+ mFr/cIz2ZmSCUkIaM2vBoeChET4HnacGFAeVZNbnQgbfhzxoJq1DgDPBHOSCLSnD5CBm Gf5vs7L2U0Ws5HGEkRgE9+3MaCNSYnJdpODZUWXXCAd9LsXkrra7SVIhYdoYlM5LmM+m N1wq6uhHtG3x4cnaLALLzajSRB3KyTlaUxSKmPln1AGDCCIPCMgs0Q8CG4r4Mxka6C0R rjZw== X-Gm-Message-State: ABUngvfwEHAgZFCTIOh3zwdBt0ehB1jLwVJzg/ytNo8m3iJuoGE0iKv8z5PXRAJvP4db8w== X-Received: by 10.36.14.75 with SMTP id 72mr1010087ite.87.1477703915871; Fri, 28 Oct 2016 18:18:35 -0700 (PDT) Received: from zony ([45.2.7.130]) by smtp.googlemail.com with ESMTPSA id k81sm4562286iod.20.2016.10.28.18.18.35 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 28 Oct 2016 18:18:35 -0700 (PDT) From: npostavs@users.sourceforge.net To: control@debbugs.gnu.org Subject: Re: bug#24801: 25.1; Reverse regexp search highlighting References: <4efa49bf-c223-4148-a291-12a722db033c@default> <8737jispf7.fsf@users.sourceforge.net> <5537d36d-a365-4a3f-97a3-78c32e86e7ea@default> <87zilqr8d1.fsf@users.sourceforge.net> <152b38c0-5aff-4c96-b976-8df0cbb3199a@default> Date: Fri, 28 Oct 2016 21:19:16 -0400 In-Reply-To: <152b38c0-5aff-4c96-b976-8df0cbb3199a@default> (Drew Adams's message of "Wed, 26 Oct 2016 18:51:53 -0700 (PDT)") Message-ID: <87twbwq7e3.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) # Emacs behaving as documented, therefore notabug tags 24801 notabug forcemerge 9681 24801 close 24801 quit Drew Adams writes: >> Isn't it? The match of aa.* "whose beginning is as close as >> possible" when point is at the of a line of a's, is "aa". So it seems >> expected that searching backwards would match pairs of a's. > > You are right. > >> Can you describe exactly how the behaviour is different in Emacs 22? > > I was mistaken. The same search hits are found in 22 (and before) > as now. Somehow I thought I was seeing something different when > I tried 22 and 20 earlier today. > >> Actually, this report looks similar to 9681, although I see no >> claims there that it worked in version 22. > > Yes, this is the same. I will close this bug. > > Funny that I never noticed this before. I guess that in practice > it doesn't bite that often. It is multiple matches in the same > line that makes this really stand out as weird behavior. From unknown Sat Jun 21 10:27:36 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 26 Nov 2016 12: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