User: scop
Date: 05/11/11 20:25:09
Modified: packages/unsupported/scop/vc ChangeLog vc-xemacs.el
Log:
Fix subst-char-in-string, thanks to Oscar Figueiredo.
Revision Changes Path
1.33 +5 -0 XEmacs/packages/unsupported/scop/vc/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/unsupported/scop/vc/ChangeLog,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -p -r1.32 -r1.33
--- ChangeLog 2005/11/10 16:44:51 1.32
+++ ChangeLog 2005/11/11 19:25:08 1.33
@@ -1,3 +1,8 @@
+2005-11-10 Oscar Figueiredo <oscar(a)xemacs.org>
+
+ * vc-xemacs.el (subst-char-in-string): Do not use `replace-in-string'
+ because of the regexp semantic on its second parameter.
+
2005-11-10 Ville Skyttä <scop(a)xemacs.org>
* vc-xemacs.el: Update FSF's address.
1.3 +9 -3 XEmacs/packages/unsupported/scop/vc/vc-xemacs.el
Index: vc-xemacs.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/unsupported/scop/vc/vc-xemacs.el,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -p -r1.2 -r1.3
--- vc-xemacs.el 2005/11/10 16:44:51 1.2
+++ vc-xemacs.el 2005/11/11 19:25:08 1.3
@@ -56,10 +56,16 @@
(defalias 'line-number-at-pos 'line-number))
(unless (fboundp 'subst-char-in-string)
- ;; Note: inplace is ignored for now
(defun subst-char-in-string (fromchar tochar string &optional inplace)
- (replace-in-string
- string (char-to-string fromchar) (char-to-string tochar))))
+ "Replace FROMCHAR with TOCHAR in STRING each time it occurs.
+Unless optional argument INPLACE is non-nil, return a new string."
+ (let ((i (length string))
+ (newstr (if inplace string (copy-sequence string))))
+ (while (> i 0)
+ (setq i (1- i))
+ (if (eq (aref newstr i) fromchar)
+ (aset newstr i tochar)))
+ newstr)))
(unless (fboundp 'replace-regexp-in-string)
;; Note: fixedcase, subexp, start ignored for now
Show replies by date