unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* return of replace-match
@ 2014-03-04 14:42 Phillip Lord
  2014-03-04 15:16 ` Michael Heerdegen
  2014-03-05  7:29 ` Alex Kost
  0 siblings, 2 replies; 7+ messages in thread
From: Phillip Lord @ 2014-03-04 14:42 UTC (permalink / raw)
  To: Help-gnu-emacs



I've been trying out "replace-match". The elisp manual says....

 -- Function: replace-match replacement &optional fixedcase literal
          string subexp
     This function performs a replacement operation on a buffer or
     string.

     If you did the last search in a buffer, you should omit the STRING
     argument or specify `nil' for it, and make sure that the current
     buffer is the one in which you performed the last search.  Then
     this function edits the buffer, replacing the matched text with
     REPLACEMENT.  It leaves point at the end of the replacement text,
     and returns `t'.


However, if I eval the progn below (with bob where it says)

(progn
  (re-search-forward "bob")
  (replace-match "fred"))

bob



point gets moved to the end of "bob" (now "fred") but "nil" is returned.


The docstring doesn't say anything at all about return types (unless
operating over a string.

Am I doing something wrong?

Phil



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

end of thread, other threads:[~2014-03-05 11:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-04 14:42 return of replace-match Phillip Lord
2014-03-04 15:16 ` Michael Heerdegen
2014-03-04 15:33   ` Phillip Lord
2014-03-05  7:29 ` Alex Kost
2014-03-05  9:15   ` Bastien
2014-03-05 10:58     ` Phillip Lord
2014-03-05 11:11     ` Nicolas Richard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).