[ cl-cookbook-Support Requests-612276 ] replace-in-string not found

"SourceForge.net" <[email protected]> Sun, 07 Dec 2003 12:16:46 -0800
Newsgroups gmane.lisp.cookbook
Message-ID <[email protected]>
Support Requests item #612276, was opened at 2002-09-20 21:55
Message generated for change (Settings changed) made by nhabedi
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=447473&aid=612276&group_id=46815

Category: None
Group: None
Status: Open
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
>Assigned to: Bill Clementson (bill_clementson)
Summary: replace-in-string not found

Initial Comment:
hello,

in completer.el, the function completer-file calls the 
function replace-in-string.  neither emacs nor i can find 
its definition.  can you help?  i'm running gnu emacs 
version 21.2.1

thanks,

-geo

[email protected]

----------------------------------------------------------------------

Comment By: Jeff Caldwell (jdcal)
Date: 2003-03-09 16:54

Message:
Logged In: YES 
user_id=727455

Add to .emacs

; From 
;  http://www.mail-archive.com/[email protected]/msg05272.html

(if (not (fboundp 'replace-in-string))
    ;;; copied from gnus-util (Oort)
    (defun replace-in-string (string regexp newtext
&optional literal)
      (let ((start 0) tail)
        (while (string-match regexp string start)
          (setq tail (- (length string) (match-end 0)))
          (setq string (replace-match newtext nil literal
string))
          (setq start (1- (- (length string) tail)))))
      string))

The 1- in the final setq start puts start at the last
character of the replacement string. Trying to sub a char
with itself loops. I haven't run into trouble with (setq
start (- (length string) tail)) but ymmv. I haven't done the
grand tour considering everything that might happen with a
sub'd regexp. I think the if-not-boundp is just there in
case the original function pops up from somewhere. If your
.emacs is settled and you're going to depend upon this
version of replace-in-string, you probably can remove the if.

Jeff Caldwell

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=447473&aid=612276&group_id=46815


-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click