[uim-commit] r1169 - in trunk: scm test
yamaken at freedesktop.org
yamaken at freedesktop.org
Tue Aug 9 11:27:05 EST 2005
Author: yamaken
Date: 2005-08-08 18:27:02 -0700 (Mon, 08 Aug 2005)
New Revision: 1169
Modified:
trunk/scm/custom-rt.scm
trunk/scm/custom.scm
trunk/test/test-custom-rt.scm
trunk/test/test-custom.scm
Log:
* This commit reverts the changes of r1163 and replace the procedure
custom-reload-configs with preexisting custom-reload-configs which
has same functionality
* scm/custom.scm
- (custom-call-all-hook-procs, custom-reload-customs): Move to
custom-rt.scm
* scm/custom-rt.scm
- (custom-call-all-hook-procs, custom-reload-customs): Moved from
custom.scm
- (custom-file-path): New procedure
- (custom-load-group-conf):
* Move currently defined procedure to
custom-load-updated-group-conf
* Revert to r1162
* Simplify with custom-file-path
* Add a comment
- (custom-load-updated-group-conf):
* Renamed from custom-load-group-conf
* Simplify with custom-file-path
- (custom-reload-configs):
* Make definition switcheable between 2 procedures
* Make custom-reload-customs default
* Replace custom-load-group-conf with custom-load-updated-group-conf
* Add a comment about it
* test/test-custom-rt.scm
* test/test-custom.scm
- Modify comments
Modified: trunk/scm/custom-rt.scm
===================================================================
--- trunk/scm/custom-rt.scm 2005-08-09 00:28:25 UTC (rev 1168)
+++ trunk/scm/custom-rt.scm 2005-08-09 01:27:02 UTC (rev 1169)
@@ -55,6 +55,15 @@
(define custom-rt-primary-groups ())
(define custom-set-hooks ())
+(define custom-file-path
+ (lambda (gsym)
+ (let* ((group-name (symbol->string gsym))
+ (path (string-append (getenv "HOME")
+ "/.uim.d/customs/custom-"
+ group-name
+ ".scm")))
+ path)))
+
(define prepend-new-reload-group-syms
(lambda (gsym path)
(set! custom-reload-group-syms
@@ -66,24 +75,29 @@
(get-file-mtime path))
#t))
-;; full implementation
-(define custom-load-group-conf
+(define custom-load-updated-group-conf
(lambda (gsym)
- (let* ((group-name (symbol->string gsym))
- (path (string-append (getenv "HOME")
- "/.uim.d/customs/custom-"
- group-name
- ".scm")))
+ (let ((path (custom-file-path gsym)))
(if (not (memq gsym (map (lambda (x) (car x)) custom-reload-group-syms)))
(prepend-new-reload-group-syms gsym path))
(if (= (get-file-mtime path)
(cdr (assq gsym custom-reload-group-syms)))
- #t ; File isn't modified, no need to reload.
+ #t ; File isn't modified, no need to reload.
(if (try-load path)
(update-gsym-mtime gsym path)
#f)))))
;; full implementation
+;; This proc is existing for DUMB loading. No more processing such as
+;; mtime comparation or history recording must not be added. Please
+;; keep in mind responsibility separation, and don't alter an API
+;; specification previously stabilized without discussion.
+;; -- YamaKen 2005-08-09
+(define custom-load-group-conf
+ (lambda (gsym)
+ (try-load (custom-file-path gsym))))
+
+;; full implementation
(define require-custom
(lambda (filename)
(let ((pre-groups (custom-list-primary-groups)))
@@ -94,10 +108,16 @@
(let* ((post-groups (custom-list-primary-groups))
(new-groups (list-tail post-groups (length pre-groups))))
(if (not (getenv "LIBUIM_VANILLA"))
- (for-each custom-load-group-conf
+ (for-each custom-load-group-conf
(reverse new-groups)))))))
;; full implementation
+(define custom-reload-customs
+ (lambda ()
+ (for-each load (reverse custom-required-custom-files))
+ (custom-call-all-hook-procs custom-set-hooks)))
+
+;; full implementation
(define custom-modify-key-predicate-names
(lambda (keys)
(map (lambda (key)
@@ -141,6 +161,14 @@
(if proc
((cdr proc))))))
+;; TODO: write test
+;; full implementation
+(define custom-call-all-hook-procs
+ (lambda (hook)
+ (for-each (lambda (pair)
+ ((cdr pair)))
+ hook)))
+
;; lightweight implementation
(define define-custom-group
(lambda (gsym label desc)
@@ -215,9 +243,25 @@
(lambda (context custom-sym val)
(custom-set-value! custom-sym val)))
+;; custom-reload-configs can switch its procedure definition from 2
+;; implementations. custom-reload-customs is selectable since the
+;; latter new code breaks the semantics of custom variable
+;; broadcasting.
+;;
+;; For example, an arbitrary uim-enabled process can update a custom
+;; variable by its own code without any helper message passing. In
+;; such case, the previously defined broadcasting behavior overwrites
+;; the variable locally modified even if the corresponding custom file
+;; is not updated.
+;;
+;; To make the latter code default, a discussion is required.
+;; -- YamaKen 2005-08-09
(define custom-reload-configs
- (lambda ()
- (let ((group-syms (map (lambda (x) (car x)) custom-reload-group-syms)))
- (if (null? group-syms)
- #f ; No file should be loaded.
- (for-each custom-load-group-conf (reverse group-syms))))))
+ (if #f
+ custom-reload-customs ;; original behavior
+ (lambda ()
+ (let ((group-syms (map (lambda (x) (car x)) custom-reload-group-syms)))
+ (if (null? group-syms)
+ #f ;; No file should be loaded.
+ (for-each custom-load-updated-group-conf
+ (reverse group-syms)))))))
Modified: trunk/scm/custom.scm
===================================================================
--- trunk/scm/custom.scm 2005-08-09 00:28:25 UTC (rev 1168)
+++ trunk/scm/custom.scm 2005-08-09 01:27:02 UTC (rev 1169)
@@ -481,13 +481,6 @@
(proc))
procs))))
-;; TODO: write test
-(define custom-call-all-hook-procs
- (lambda (hook)
- (for-each (lambda (pair)
- ((cdr pair)))
- hook)))
-
(define-record 'custom-rec
'((sym #f)
(default #f)
@@ -744,11 +737,6 @@
(let ((cb (lambda () (gate-func func ptr custom-sym))))
(custom-add-hook custom-sym hook cb)))))
-(define custom-reload-customs
- (lambda ()
- (for-each load (reverse custom-required-custom-files))
- (custom-call-all-hook-procs custom-set-hooks)))
-
(define-custom-group 'main
(_ "-")
(_ "Main settings of this group"))
Modified: trunk/test/test-custom-rt.scm
===================================================================
--- trunk/test/test-custom-rt.scm 2005-08-09 00:28:25 UTC (rev 1168)
+++ trunk/test/test-custom-rt.scm 2005-08-09 01:27:02 UTC (rev 1169)
@@ -29,6 +29,10 @@
;;; SUCH DAMAGE.
;;;;
+;; TODO:
+;;
+;; custom-reload-customs
+
(use test.unit)
(require "test/uim-test-utils")
Modified: trunk/test/test-custom.scm
===================================================================
--- trunk/test/test-custom.scm 2005-08-09 00:28:25 UTC (rev 1168)
+++ trunk/test/test-custom.scm 2005-08-09 01:27:02 UTC (rev 1169)
@@ -33,9 +33,7 @@
;; TODO:
;;
-;; custom-reload-customs
;; custom-broadcast-customs
-;; custom-broadcast-customs
(use test.unit)
More information about the uim-commit
mailing list