[uim-commit] r472 - trunk/scm

yamaken at freedesktop.org yamaken at freedesktop.org
Tue Feb 1 15:07:03 PST 2005


Author: yamaken
Date: 2005-02-01 15:06:55 -0800 (Tue, 01 Feb 2005)
New Revision: 472

Modified:
   trunk/scm/custom.scm
   trunk/scm/util.scm
Log:
* scm/util.scm
  - (string-escape): New procedure
* scm/custom.scm
  - (custom-list-as-literal, custom-value-as-literal): Fix broken
    string escapeing


Modified: trunk/scm/custom.scm
===================================================================
--- trunk/scm/custom.scm	2005-02-01 22:59:48 UTC (rev 471)
+++ trunk/scm/custom.scm	2005-02-01 23:06:55 UTC (rev 472)
@@ -610,7 +610,7 @@
 				 ((symbol? elem)
 				  (symbol->string elem))
 				 ((string? elem)
-				  (string-append "\"" elem "\""))
+				  (string-escape elem))
 				 (else
 				  "")))
 			      lst)))
@@ -620,16 +620,14 @@
 (define custom-value-as-literal
   (lambda (sym)
     (let ((val (custom-value sym))
-	  (type (custom-type sym))
-	  (as-string (lambda (s)
-		       (string-append "\"" s "\""))))
+	  (type (custom-type sym)))
       (cond
        ((eq? type 'integer)
 	(digit->string val))
        ((eq? type 'string)
-	(as-string val))
+	(string-escape val))
        ((eq? type 'pathname)
-	(as-string val))
+	(string-escape val))
        ((eq? type 'choice)
 	(string-append "'" (symbol->string val)))
        ((or (eq? type 'ordered-list)

Modified: trunk/scm/util.scm
===================================================================
--- trunk/scm/util.scm	2005-02-01 22:59:48 UTC (rev 471)
+++ trunk/scm/util.scm	2005-02-01 23:06:55 UTC (rev 472)
@@ -96,6 +96,12 @@
 (define usual-char? char-graphic?)
 (define to-lower-char char-downcase)
 
+;; TODO: write test
+(define string-escape
+  (lambda (s)
+    (let ((buf (string-append "\"\"" s s)))
+      (print-to-string s buf))))
+
 (define string->letter
   (lambda (str)
     (let ((c (and (= (string-length str)



More information about the Uim-commit mailing list