Revision: 6898
Author: ek.kato
Date: Tue Jan 4 23:00:13 2011
Log: * scm/plugin.scm
- (try-require-with-force-reload) : New.
- (require-module) : Reload scm file even the file is already
loaded. This prevents using stub init-handler incorrectly
when switch to an IM of the re-enabled module by uim-pref.
- (module_load) : Ditto.
http://code.google.com/p/uim/source/detail?r=6898
Modified:
/trunk/scm/plugin.scm
=======================================
--- /trunk/scm/plugin.scm Tue Sep 7 22:49:19 2010
+++ /trunk/scm/plugin.scm Tue Jan 4 23:00:13 2011
@@ -55,16 +55,25 @@
(define installed-im-module-list ())
(define currently-loading-module-name #f)
+(define try-require-with-force-reload
+ (lambda (file)
+ (let ((loaded-str (string-append "*" file "-loaded*")))
+ (if (provided? loaded-str)
+ (try-load file)
+ (try-require file)))))
;;
;; TODO: write test for load-plugin
;; returns whether initialization is succeeded
(define require-module
(lambda (module-name)
(set! currently-loading-module-name module-name)
+ ;; use try-require-with-force-reload because init-handler of the
+ ;; im may be overwritten by stub-im handler
(let ((succeeded (or (module-load module-name)
- (try-require (find-module-scm-path
- uim-plugin-scm-load-path
- module-name)))))
+ (try-require-with-force-reload
+ (find-module-scm-path
+ uim-plugin-scm-load-path
+ module-name)))))
(set! currently-loading-module-name #f)
succeeded)))
@@ -133,6 +142,8 @@
(let ((scm-path (find-module-scm-path
uim-plugin-scm-load-path module-name)))
(if (string? scm-path)
- (try-require scm-path)
+ ;; use try-require-with-force-reload because init-handler of the
+ ;; im may be overwritten by stub-im handler
+ (try-require-with-force-reload scm-path)
#t))
#f)))