[uim-commit] r443 - trunk/scm

yamaken at freedesktop.org yamaken at freedesktop.org
Mon Jan 31 17:27:03 PST 2005


Author: yamaken
Date: 2005-01-31 17:27:00 -0800 (Mon, 31 Jan 2005)
New Revision: 443

Modified:
   trunk/scm/anthy-custom.scm
   trunk/scm/canna-custom.scm
   trunk/scm/custom-rt.scm
   trunk/scm/im-custom.scm
   trunk/scm/prime-custom.scm
   trunk/scm/skk-custom.scm
Log:
* This commit enables limited version of set-hook invocation with
  custom-rt.scm. It results that im-default-name and toolbar
  configurations in running processes are dynamically updated on the
  fly

* scm/custom-rt.scm
  - (custom-set-hooks): New variable
  - (custom-add-hook): Implement lightweight hook handling only works
    for custom-set-hooks
  - (custom-set-value!): Add set-hook handling

* scm/anthy-custom.scm
* scm/canna-custom.scm
* scm/prime-custom.scm
* scm/skk-custom.scm
  - Enclose set-hooks that handles metainformation of the custom
    variable into (if custom-full-featured?) block to enable the
    lightweight set-hook invocation
  - Fix *-configure-widgets invocation

* scm/im-custom.scm
  - (custom custom-activate-default-im-name?): Add a comment


Modified: trunk/scm/anthy-custom.scm
===================================================================
--- trunk/scm/anthy-custom.scm	2005-02-01 00:47:16 UTC (rev 442)
+++ trunk/scm/anthy-custom.scm	2005-02-01 01:27:00 UTC (rev 443)
@@ -169,7 +169,7 @@
 (custom-add-hook 'anthy-widgets
 		 'custom-set-hooks
 		 (lambda ()
-		   anthy-configure-widgets))
+		   (anthy-configure-widgets)))
 
 
 ;;; Input mode
@@ -192,13 +192,14 @@
   (_ "long description will be here."))
 
 ;; value dependency
-(custom-add-hook 'anthy-input-mode-actions
-		 'custom-set-hooks
-		 (lambda ()
-		   (custom-choice-range-reflect-olist-val
-		    'default-widget_anthy_input_mode
-		    'anthy-input-mode-actions
-		    anthy-input-mode-indication-alist)))
+(if custom-full-featured?
+    (custom-add-hook 'anthy-input-mode-actions
+		     'custom-set-hooks
+		     (lambda ()
+		       (custom-choice-range-reflect-olist-val
+			'default-widget_anthy_input_mode
+			'anthy-input-mode-actions
+			anthy-input-mode-indication-alist))))
 
 ;; activity dependency
 (custom-add-hook 'default-widget_anthy_input_mode
@@ -215,12 +216,12 @@
 (custom-add-hook 'default-widget_anthy_input_mode
 		 'custom-set-hooks
 		 (lambda ()
-		   anthy-configure-widgets))
+		   (anthy-configure-widgets)))
 
 (custom-add-hook 'anthy-input-mode-actions
 		 'custom-set-hooks
 		 (lambda ()
-		   anthy-configure-widgets))
+		   (anthy-configure-widgets)))
 
 ;;; Kana input method
 
@@ -242,13 +243,14 @@
   (_ "long description will be here."))
 
 ;; value dependency
-(custom-add-hook 'anthy-kana-input-method-actions
-		 'custom-set-hooks
-		 (lambda ()
-		   (custom-choice-range-reflect-olist-val
-		    'default-widget_anthy_kana_input_method
-		    'anthy-kana-input-method-actions
-		    anthy-kana-input-method-indication-alist)))
+(if custom-full-featured?
+    (custom-add-hook 'anthy-kana-input-method-actions
+		     'custom-set-hooks
+		     (lambda ()
+		       (custom-choice-range-reflect-olist-val
+			'default-widget_anthy_kana_input_method
+			'anthy-kana-input-method-actions
+			anthy-kana-input-method-indication-alist))))
 
 ;; activity dependency
 (custom-add-hook 'default-widget_anthy_kana_input_method
@@ -265,9 +267,9 @@
 (custom-add-hook 'default-widget_anthy_kana_input_method
 		 'custom-set-hooks
 		 (lambda ()
-		   anthy-configure-widgets))
+		   (anthy-configure-widgets)))
 
 (custom-add-hook 'anthy-kana-input-method-actions
 		 'custom-set-hooks
 		 (lambda ()
-		   anthy-configure-widgets))
+		   (anthy-configure-widgets)))

Modified: trunk/scm/canna-custom.scm
===================================================================
--- trunk/scm/canna-custom.scm	2005-02-01 00:47:16 UTC (rev 442)
+++ trunk/scm/canna-custom.scm	2005-02-01 01:27:00 UTC (rev 443)
@@ -98,6 +98,7 @@
 		     (_ "Canna server")
 		     (_ "long description will be here."))
 
+;; warning: must be defined before custom-preserved-canna-server-name
 (define-custom 'custom-activate-canna-server-name? #f
   '(canna cannaserver)
   '(boolean)
@@ -235,7 +236,7 @@
 (custom-add-hook 'canna-widgets
 		 'custom-set-hooks
 		 (lambda ()
-		   canna-configure-widgets))
+		   (canna-configure-widgets)))
 
 
 ;;; Input mode
@@ -258,13 +259,14 @@
   (_ "long description will be here."))
 
 ;; value dependency
-(custom-add-hook 'canna-input-mode-actions
-		 'custom-set-hooks
-		 (lambda ()
-		   (custom-choice-range-reflect-olist-val
-		    'default-widget_canna_input_mode
-		    'canna-input-mode-actions
-		    canna-input-mode-indication-alist)))
+(if custom-full-featured?
+    (custom-add-hook 'canna-input-mode-actions
+		     'custom-set-hooks
+		     (lambda ()
+		       (custom-choice-range-reflect-olist-val
+			'default-widget_canna_input_mode
+			'canna-input-mode-actions
+			canna-input-mode-indication-alist))))
 
 ;; activity dependency
 (custom-add-hook 'default-widget_canna_input_mode
@@ -281,12 +283,12 @@
 (custom-add-hook 'default-widget_canna_input_mode
 		 'custom-set-hooks
 		 (lambda ()
-		   canna-configure-widgets))
+		   (canna-configure-widgets)))
 
 (custom-add-hook 'canna-input-mode-actions
 		 'custom-set-hooks
 		 (lambda ()
-		   canna-configure-widgets))
+		   (canna-configure-widgets)))
 
 ;;; Kana input method
 
@@ -308,13 +310,14 @@
   (_ "long description will be here."))
 
 ;; value dependency
-(custom-add-hook 'canna-kana-input-method-actions
-		 'custom-set-hooks
-		 (lambda ()
-		   (custom-choice-range-reflect-olist-val
-		    'default-widget_canna_kana_input_method
-		    'canna-kana-input-method-actions
-		    canna-kana-input-method-indication-alist)))
+(if custom-full-featured?
+    (custom-add-hook 'canna-kana-input-method-actions
+		     'custom-set-hooks
+		     (lambda ()
+		       (custom-choice-range-reflect-olist-val
+			'default-widget_canna_kana_input_method
+			'canna-kana-input-method-actions
+			canna-kana-input-method-indication-alist))))
 
 ;; activity dependency
 (custom-add-hook 'default-widget_canna_kana_input_method
@@ -331,9 +334,9 @@
 (custom-add-hook 'default-widget_canna_kana_input_method
 		 'custom-set-hooks
 		 (lambda ()
-		   canna-configure-widgets))
+		   (canna-configure-widgets)))
 
 (custom-add-hook 'canna-kana-input-method-actions
 		 'custom-set-hooks
 		 (lambda ()
-		   canna-configure-widgets))
+		   (canna-configure-widgets)))

Modified: trunk/scm/custom-rt.scm
===================================================================
--- trunk/scm/custom-rt.scm	2005-02-01 00:47:16 UTC (rev 442)
+++ trunk/scm/custom-rt.scm	2005-02-01 01:27:00 UTC (rev 443)
@@ -52,6 +52,7 @@
 
 (define custom-required-custom-files ())
 (define custom-rt-primary-groups ())
+(define custom-set-hooks ())
 
 ;; full implementation
 (define custom-load-group-conf
@@ -103,10 +104,15 @@
   (lambda ()
     (reverse custom-rt-primary-groups)))
 
+;; TODO: write test
 ;; lightweight implementation
 (define custom-add-hook
   (lambda (custom-sym hook-sym proc)
-    #f))
+    (if (eq? hook-sym
+	     'custom-set-hooks)
+	(set! custom-set-hooks
+	      (alist-replace (cons custom-sym proc)
+			     custom-set-hooks)))))
 
 ;; lightweight implementation
 (define define-custom-group
@@ -132,22 +138,27 @@
   (lambda (sym)
     (symbol-value sym)))
 
+;; TODO: rewrite test
 ;; lightweight implementation
 (define custom-set-value!
   (lambda (sym val)
-    (cond
-     ((custom-key-exist? sym)
-      (set-symbol-value! sym val)
-      (let ((key-val (custom-modify-key-predicate-names val)))
-	(eval (list 'define (symbolconc sym '?)
-		    (list 'make-key-predicate (list 'quote key-val)))
-	      toplevel-env))
-      #t)
-     ((custom-exist? sym #f)
-      (set-symbol-value! sym val)
-      #t)
-     (else
-      #f))))
+    (and (cond
+	  ((custom-key-exist? sym)
+	   (set-symbol-value! sym val)
+	   (let ((key-val (custom-modify-key-predicate-names val)))
+	     (eval (list 'define (symbolconc sym '?)
+			 (list 'make-key-predicate (list 'quote key-val)))
+		   toplevel-env))
+	   #t)
+	  ((custom-exist? sym #f)
+	   (set-symbol-value! sym val)
+	   #t)
+	  (else
+	   #f))
+	 (let ((hook (assq sym custom-set-hooks)))
+	   (if hook
+	       ((cdr hook)))
+	   #t))))
 
 ;; lightweight implementation
 (define define-custom

Modified: trunk/scm/im-custom.scm
===================================================================
--- trunk/scm/im-custom.scm	2005-02-01 00:47:16 UTC (rev 442)
+++ trunk/scm/im-custom.scm	2005-02-01 01:27:00 UTC (rev 443)
@@ -67,6 +67,7 @@
 		     (_ "Default input method")
 		     (_ "long description will be here."))
 
+;; warning: must be defined before custom-preserved-default-im-name
 (define-custom 'custom-activate-default-im-name? #f
   '(global default-im-name)
   '(boolean)

Modified: trunk/scm/prime-custom.scm
===================================================================
--- trunk/scm/prime-custom.scm	2005-02-01 00:47:16 UTC (rev 442)
+++ trunk/scm/prime-custom.scm	2005-02-01 01:27:00 UTC (rev 443)
@@ -154,22 +154,23 @@
   (_ "long description will be here."))
 
 ;; value dependency
-(custom-add-hook 'prime-input-mode-actions
-		 'custom-set-hooks
-		 (lambda ()
-		   (custom-choice-range-reflect-olist-val
-		    'default-widget_prime_input_mode
-		    'prime-input-mode-actions
-		    prime-input-mode-indication-alist)))
+(if custom-full-featured?
+    (custom-add-hook 'prime-input-mode-actions
+		     'custom-set-hooks
+		     (lambda ()
+		       (custom-choice-range-reflect-olist-val
+			'default-widget_prime_input_mode
+			'prime-input-mode-actions
+			prime-input-mode-indication-alist))))
 
 ;; dynamic reconfiguration
 (custom-add-hook 'default-widget_prime_input_mode
 		 'custom-set-hooks
 		 (lambda ()
-		   prime-configure-widgets))
+		   (prime-configure-widgets)))
 
 (custom-add-hook 'prime-input-mode-actions
 		 'custom-set-hooks
 		 (lambda ()
-		   prime-configure-widgets))
+		   (prime-configure-widgets)))
 

Modified: trunk/scm/skk-custom.scm
===================================================================
--- trunk/scm/skk-custom.scm	2005-02-01 00:47:16 UTC (rev 442)
+++ trunk/scm/skk-custom.scm	2005-02-01 01:27:00 UTC (rev 443)
@@ -219,22 +219,23 @@
   (_ "long description will be here."))
 
 ;; value dependency
-(custom-add-hook 'skk-input-mode-actions
-		 'custom-set-hooks
-		 (lambda ()
-		   (custom-choice-range-reflect-olist-val
-		    'default-widget_skk_input_mode
-		    'skk-input-mode-actions
-		    skk-input-mode-indication-alist)))
+(if custom-full-featured?
+    (custom-add-hook 'skk-input-mode-actions
+		     'custom-set-hooks
+		     (lambda ()
+		       (custom-choice-range-reflect-olist-val
+			'default-widget_skk_input_mode
+			'skk-input-mode-actions
+			skk-input-mode-indication-alist))))
 
 ;; dynamic reconfiguration
 (custom-add-hook 'default-widget_skk_input_mode
 		 'custom-set-hooks
 		 (lambda ()
-		   skk-configure-widgets))
+		   (skk-configure-widgets)))
 
 (custom-add-hook 'skk-input-mode-actions
 		 'custom-set-hooks
 		 (lambda ()
-		   skk-configure-widgets))
+		   (skk-configure-widgets)))
 



More information about the Uim-commit mailing list