GNU bug report logs - #21279
24.4; (match-end 0) doesn't always return nil when previous string-match fails

Previous Next

Package: emacs;

Reported by: Ernesto Alfonso <erjoalgo <at> gmail.com>

Date: Mon, 17 Aug 2015 06:27:02 UTC

Severity: minor

Found in version 24.4

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 21279 in the body.
You can then email your comments to 21279 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#21279; Package emacs. (Mon, 17 Aug 2015 06:27:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ernesto Alfonso <erjoalgo <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 17 Aug 2015 06:27:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ernesto Alfonso <erjoalgo <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.4;
 (match-end 0) doesn't always return nil when previous string-match
 fails 
Date: Sun, 16 Aug 2015 23:20:11 -0400
(match-end 0) doesn't always return nil when previous string-match fails:


(progn
	 (string-match "a+" "aaa")
	 (match-end 0)
	 (string-match "a+" "bbb")
	 (match-end 0)) 

returns 3, should be nil:

"match-end is a built-in function in `search.c'.
[...]
Value is nil if SUBEXPth pair didn't match, or there were less than
  SUBEXP pairs.
  "

             



In GNU Emacs 24.4.1 (x86_64-pc-linux-gnu, GTK+ Version 3.14.5)
 of 2015-03-07 on trouble, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.11604000
System Description:	Debian GNU/Linux 8.1 (jessie)

Configured using:
 `configure --build x86_64-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/emacs24:/etc/emacs:/usr/local/share/emacs/24.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.4/site-lisp:/usr/share/emacs/site-lisp
 --build x86_64-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/emacs24:/etc/emacs:/usr/local/share/emacs/24.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.4/site-lisp:/usr/share/emacs/site-lisp
 --with-x=yes --with-x-toolkit=gtk3 --with-toolkit-scroll-bars
 'CFLAGS=-g -O2 -fstack-protector-strong -Wformat
 -Werror=format-security -Wall' CPPFLAGS=-D_FORTIFY_SOURCE=2
 LDFLAGS=-Wl,-z,relro'

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Summary

Minor modes in effect:
  erc-list-mode: t
  erc-menu-mode: t
  erc-autojoin-mode: t
  erc-ring-mode: t
  erc-networks-mode: t
  erc-pcomplete-mode: t
  erc-track-mode: t
  erc-track-minor-mode: t
  erc-match-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-netsplit-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-move-to-prompt-mode: t
  erc-readonly-mode: t
  diff-auto-refine-mode: t
  text-scale-mode: t
  global-command-mode: t
  buttons-mode: 0
  command-mode: t
  shell-dirtrack-mode: t
  global-text-scale-mode: t
  show-paren-mode: t
  global-auto-complete-mode: t
  compile-run-mode: t
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<f2> c x e <f2> / / s-? C-g <f2> x e 1 M-1 2 n n n 
n M-f M-f : SPC x e c / s-? <f1> 1 <f2> 1 1 <f2> <f1> 
<f1> <f2> <f2> e <f1> s e t i t e m <return> <f1> c 
<f1> c e b b SPC s-G e x e s c s-? <up> <return> p 
p p 1 K c b b b b b b f b b b M-b s-3 u p c a s e SPC 
<f1> M-f <escape> M-b M-f f M-b j M-f j e n 1 n n x 
e s c s-? <up> <return> K K p p p n / / / / / / / s-: 
/ s-? <up> e n t e r SPC <return> 2 p n n n n n n n 
n e j s-? s e t i t e m SPC p r o m i s e <return> 
1 2 c 1 1 p e 1 n p n M-b n K x e s c 2 2 2 2 2 2 2 
2 2 1 1 1 n e j s-? o n <M-backspace> s e t i t e m 
SPC t r a n s a c t i o n SPC o n c o m p l e t e <return> 
p 1 p p 1 p 1 p p p p p p p p p p p p p n e j s-? <up> 
M-f C-f C-k o n SPC v a l u e <return> <f9> x i e c 
M-x r e p o r t <tab> <return> C-g x o C-g M-x r e 
p o r t - e m <tab> <return>

Recent messages:

now playing: /home/ealfonso/Music/ytdl/Billy Joel New York state of mind-ol0dPJdzm1M.mp3
count is 3 
debug-random-line
Saving file /home/ealfonso/repos/dotemacs/.emacs...
Wrote /home/ealfonso/repos/dotemacs/.emacs
count is 3  [2 times]
(Shell command succeeded with no output)
change: stopped (signal)

Quit [2 times]

Load-path shadows:
/home/ealfonso/repos/dotemacs/experimental/go-mode hides /home/ealfonso/repos/dotemacs/emacs_external_libraries/go-mode
/home/ealfonso/repos/dotemacs/experimental/dired-sort-menu hides /home/ealfonso/repos/dotemacs/emacs_external_libraries/dired-sort-menu
/usr/share/emacs/24.4/site-lisp/debian-startup hides /usr/share/emacs/site-lisp/debian-startup
/home/ealfonso/repos/dotemacs/experimental/dired hides /usr/share/emacs/24.4/lisp/dired
/home/ealfonso/repos/dotemacs/emacs_external_libraries/ls-lisp hides /usr/share/emacs/24.4/lisp/ls-lisp
/usr/share/emacs24/site-lisp/dictionaries-common/ispell hides /usr/share/emacs/24.4/lisp/textmodes/ispell
/usr/share/emacs/site-lisp/rst hides /usr/share/emacs/24.4/lisp/textmodes/rst
/usr/share/emacs24/site-lisp/dictionaries-common/flyspell hides /usr/share/emacs/24.4/lisp/textmodes/flyspell
/home/ealfonso/repos/dotemacs/emacs_external_libraries/emacsplanner/remember/remember hides /usr/share/emacs/24.4/lisp/textmodes/remember
/home/ealfonso/repos/dotemacs/emacs_external_libraries/cl-lib hides /usr/share/emacs/24.4/lisp/emacs-lisp/cl-lib

Features:
(shadow emacsbug erc-list erc-menu erc-join erc-ring erc-networks
erc-pcomplete erc-track erc-match erc-button erc-fill erc-stamp
erc-netsplit erc-goodies erc erc-backend erc-compat cl-indent mailalias
smtpmail sendmail gnus-cite nnir url-handlers tramp-cache slime
slime-autoloads em-unix em-term term ehelp em-script em-prompt em-ls
em-hist em-pred em-glob em-dirs em-cmpl em-basic em-banner em-alias
esh-var esh-io esh-cmd esh-opt esh-ext esh-proc esh-arg eldoc esh-groups
eshell esh-module esh-mode esh-util mail-extr nxml-uchnm rng-xsd
xsd-regexp rng-cmpct rng-nxml rng-valid rng-loc rng-uri rng-parse
nxml-parse rng-match rng-dt rng-util rng-pttrn nxml-ns nxml-mode
nxml-outln nxml-rap nxml-util nxml-glyph nxml-enc xmltok tabify
sh-script smie executable macros mule-util ielm qp gnus-ml disp-table
nndraft nnmh nnfolder utf-7 gnutls nnimap parse-time utf7 netrc
gnus-agent gnus-srvr gnus-score score-mode nnvirtual gnus-msg gnus-art
mm-uu mml2015 mm-view mml-smime smime dig nntp gnus-cache gnus-sum nnoo
gnus-group gnus-undo nnmail mail-source gnus-start gnus-spec gnus-int
gnus-range message rfc822 mml mml-sec mailabbrev gmm-utils mailheader
gnus-win gnus gnus-ems nnheader mail-utils tramp-sh smerge-mode
diff-mode diff pcmpl-unix files-x debug sql view dired-aux face-remap
misearch multi-isearch network-stream starttls gud apropos compile
arc-mode archive-mode pp hyperspec browse-url loadhist auto-imports moz
edebug package epg-config matlab-load calfw-ical icalendar server
cc-langs js imenu dired-details dired desktop frameset org-jira jiralib
soap-client mm-decode mm-bodies mm-encode url-http tls url-auth
mail-parse rfc2231 rfc2047 rfc2045 ietf-drums url-gw warnings xml org
org-macro org-footnote org-pcomplete org-list org-faces org-entities
noutline outline org-version ob-emacs-lisp ob ob-tangle ob-ref ob-lob
ob-table ob-exp org-src ob-keys ob-comint ob-core ob-eval org-compat
org-macs org-loaddefs find-func jison-mode bison-mode cc-mode cc-fonts
cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs
python json ls-lisp planner-cyclic diary-lib diary-loaddefs planner sort
muse-html muse-xml-common muse-colors cus-edit cus-start cus-load
muse-publish muse-project muse-protocols muse-regexps muse
muse-nested-tags muse-mode vc-git tramp tramp-compat tramp-loaddefs
trampver shell pcomplete comint ansi-color format-spec goto-last-change
help-fns+ help-mode info wid-edit fuzzy-match quick-yes paren calfw
holidays hol-loaddefs cal-menu easymenu calendar cal-loaddefs go-mode
derived url url-proxy url-privacy url-expand url-methods url-history
url-cookie url-domsuf url-util mailcap find-file ffap thingatpt
url-parse auth-source eieio byte-opt bytecomp byte-compile cconv
eieio-core gnus-util mm-util mail-prsvr password-cache url-vars etags
ring auto-complete-config auto-complete popup dired-quick-tagger airmacs
compile-run tetris-o-1 advice help-fns music-player gmail-contacts
eshell-aliases erjoalgo-indent-mode debian-forum-post-mode edmacro
kmacro cl-macs easy-mmode cl gv cl-loaddefs cl-lib time-date tooltip
electric uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment
lisp-mode prog-mode register page menu-bar rfn-eshadow timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese hebrew greek romanian slovak czech european ethiopic
indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple
abbrev minibuffer nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
dbusbind gfilenotify dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)

Memory information:
((conses 16 2397617 377103)
 (symbols 48 63240 168)
 (miscs 40 4291 3918)
 (strings 32 1290623 19561)
 (string-bytes 1 12209733)
 (vectors 16 59388)
 (vector-slots 8 1831422 157081)
 (floats 8 677 2636)
 (intervals 56 85989 2260)
 (buffers 960 187)
 (heap 1024 173419 19410))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21279; Package emacs. (Mon, 17 Aug 2015 07:27:02 GMT) Full text and rfc822 format available.

Message #8 received at 21279 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> suse.de>
To: Ernesto Alfonso <erjoalgo <at> gmail.com>
Cc: 21279 <at> debbugs.gnu.org
Subject: Re: bug#21279: 24.4;
 (match-end 0) doesn't always return nil when previous string-match
 fails
Date: Mon, 17 Aug 2015 09:26:39 +0200
Ernesto Alfonso <erjoalgo <at> gmail.com> writes:

> (match-end 0) doesn't always return nil when previous string-match fails:

A failing match doesn't set match-data.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab <at> suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21279; Package emacs. (Mon, 17 Aug 2015 07:35:02 GMT) Full text and rfc822 format available.

Message #11 received at 21279 <at> debbugs.gnu.org (full text, mbox):

From: Ernesto Alfonso <erjoalgo <at> gmail.com>
To: Andreas Schwab <schwab <at> suse.de>
Cc: Ernesto Alfonso <erjoalgo <at> gmail.com>, 21279 <at> debbugs.gnu.org
Subject: Re: bug#21279: 24.4;
 (match-end 0) doesn't always return nil when previous string-match
 fails
Date: Mon, 17 Aug 2015 03:34:06 -0400
I see.

I think the documentation of match-end and others should be updated, though, since right now it is a little misleading:

"Value is nil if SUBEXPth pair didn't match, or there were less than
  SUBEXP pairs.
"

seems to suggest that if match fails, value should be nil. I was certaily confused.

Ernesto
Andreas Schwab <schwab <at> suse.de> writes:

> Ernesto Alfonso <erjoalgo <at> gmail.com> writes:
>
>> (match-end 0) doesn't always return nil when previous string-match fails:
>
> A failing match doesn't set match-data.
>
> Andreas.




Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Tue, 18 Aug 2015 06:52:01 GMT) Full text and rfc822 format available.

Notification sent to Ernesto Alfonso <erjoalgo <at> gmail.com>:
bug acknowledged by developer. (Tue, 18 Aug 2015 06:52:02 GMT) Full text and rfc822 format available.

Message #16 received at 21279-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Ernesto Alfonso <erjoalgo <at> gmail.com>
Cc: 21279-done <at> debbugs.gnu.org
Subject: Re:  24.4; (match-end 0) doesn't always return nil when previous
 string-match fails
Date: Mon, 17 Aug 2015 23:51:10 -0700
I updated the documentation along the lines that you suggested, as master commit 
7a68ebe0485d049a3fbbfd77d0ba5773e8e6ae87 and am marking this bug as done. 
Thanks for reporting it.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 15 Sep 2015 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 7 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.