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

Re: Rename `sb-tdiary.el' to `sb-tdiary-ml.el'



replace-regexp-in-string という関数は Emacs 21 にしか存在しない
ようです。以下は gnus-util.el のやり方で、引数の並びは XEmacs の
replace-in-string に合わせています。

(eval-and-compile
  (cond
   ((fboundp 'replace-in-string)
    (defalias 'gnus-replace-in-string 'replace-in-string))
   ((fboundp 'replace-regexp-in-string)
    (defun gnus-replace-in-string  (string regexp newtext &optional literal)
      (replace-regexp-in-string regexp newtext string nil literal)))
   (t
    (defun gnus-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 (- (length string) tail))))
      string))))
-- 
Katsumi Yamaoka <yamaoka@jpl.org>