all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Bug Report -- replace-regexp-in-string from subr.el
@ 2014-04-19 23:50 Sam Fiechter
  2014-04-20  6:40 ` Andreas Schwab
  0 siblings, 1 reply; 3+ messages in thread
From: Sam Fiechter @ 2014-04-19 23:50 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 938 bytes --]

Hi,

I noticed that the lisp function replace-regexp-in-string from emacs
24.4.50.1 does not pass the sub-expression match when the rep is a function
call rather than a string.
For Example:
(progn
  (defun samscat (s)
      (concat "[" s "]"))
 (replace-regexp-in-string "\\(foo\\).*\\'" 'samscat " foo foo" nil nil 1))

returns:
" [foo foo] foo"
 not:
" [foo] foo"

looking at the code, I notice that the sub-expression is hard-coded on line
3642 of subr.el.gz:
     (funcall rep (match-string 0 str)))
rather than:
     (funcall rep (match-string (or subexp 0) str)))

I hope this is helpful!

Here's my about emacs screen:
This is GNU Emacs, one component of the GNU/Linux operating system.

GNU Emacs 24.4.50.1 (i686-pc-linux-gnu, GTK+ Version 2.24.10)
 of 2014-03-30 on lenovo-laptop
Copyright (C) 2014 Free Software Foundation, Inc.

If you would like any other info please let me know.

Best,

Sam

-- 
Sam Fiechter
(302) 689-3798

[-- Attachment #2: Type: text/html, Size: 1599 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-04-21 14:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-19 23:50 Bug Report -- replace-regexp-in-string from subr.el Sam Fiechter
2014-04-20  6:40 ` Andreas Schwab
2014-04-21 14:06   ` Davis Herring

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.