Subject: bug#11025: 23.1; re-search-backward does not find the right beginning of the regexp

From: Jack Duthen <[email-masked]>
Date: Fri, 16 Mar 2012 12:40:22 +0100

--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)
"\(\(^\|[^\\
]\)\(\\\\\)*\);+ *"  <-- 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 match
; (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".
; => Bug

In GNU Emacs 23.1.1 (i686-pc-linux-gnu, GTK+ Version 2.22.0)
 of 2011-03-04 on roseapple, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.10900000
configured using `configure  '--build=i686-linux-gnu'
'--host=i686-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib'
'--libexecdir=/usr/lib' '--localstatedir=/var/lib'
'--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes'
'--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.1/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.1/leim'
'--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars'
'build_alias=i686-linux-gnu' 'host_alias=i686-linux-gnu'
'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS=''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: fr_FR.utf8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: Emacs-Lisp

Minor modes in effect:
  which-function-mode: t
  diff-auto-refine-mode: t
  eldoc-mode: t
  show-paren-mode: t
  recentf-mode: t
  desktop-save-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<menu-bar> <help-menu> <send-emacs-bug-report>

Recent messages:
/usr/bin/mail is not an executable.  Setting mail-interactive to t.

)jack(