help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

return of replace-match


From: Phillip Lord
Subject: return of replace-match
Date: Tue, 04 Mar 2014 14:42:48 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)


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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]