[cl-cookbook-contrib] [ cl-cookbook-Support Requests-612276 ] replace-in-string not found
Brought to you by:
jthing
From: SourceForge.net <no...@so...> - 2003-12-07 20:16:47
|
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 geo...@ho... ---------------------------------------------------------------------- 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/jd...@su.../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 |