Author: sasugaanija
Date: Mon Sep 24 01:53:54 2007
New Revision: 5011
Modified:
trunk/emacs/uim-key.el
trunk/emacs/uim.el
Log:
* This change makes uim.el to restore the original
this-command-keys when uim-mode is turned off.
* emacs/uim-key.el
- (uim-backup-this-command-keys): Removed (merge with
uim-this-command-keys-override)
- (uim-this-command-keys-override):
* Merge uim-this-command-keys-override
* use fset instead of defun
- (uim-this-command-keys-restore): New function to restore
original this-command-keys
* emacs/uim.el
- (uim-init): Remove uim-this-command-keys-override
- (uim-mode-on): Call uim-this-command-keys-override
- (uim-mode-off): Call uim-this-command-keys-restore
Modified: trunk/emacs/uim-key.el
==============================================================================
--- trunk/emacs/uim-key.el (original)
+++ trunk/emacs/uim-key.el Mon Sep 24 01:53:54 2007
@@ -134,24 +134,26 @@
(undo-boundary)
)
-(defun uim-backup-this-command-keys ()
- (when (not uim-this-command-keys-original)
- ;;(uim-debug "this-command-keys backup!")
- (setq uim-this-command-keys-original
- (symbol-function 'this-command-keys))))
-
(defun uim-this-command-keys-override ()
(if (not uim-this-command-keys-original)
(let ((doc (documentation 'this-command-keys)))
- (uim-backup-this-command-keys)
- (eval
- `(defun this-command-keys ()
- ,doc
- (if (and (boundp 'uim-key-vector)
- uim-key-vector)
- uim-key-vector
- (funcall uim-this-command-keys-original)))))))
+
+ (setq uim-this-command-keys-original
+ (symbol-function 'this-command-keys))
+
+ (eval
+ `(fset 'this-command-keys
+ '(lambda ()
+ ,doc
+ (if (and (boundp 'uim-key-vector) uim-key-vector)
+ uim-key-vector
+ (funcall uim-this-command-keys-original))))))))
+
+
+(defun uim-this-command-keys-restore ()
+ (fset 'this-command-keys uim-this-command-keys-original)
+ (setq uim-this-command-keys-original nil))
(defun uim-command-execute (uim-key-vector &optional bind)
Modified: trunk/emacs/uim.el
==============================================================================
--- trunk/emacs/uim.el (original)
+++ trunk/emacs/uim.el Mon Sep 24 01:53:54 2007
@@ -383,6 +383,9 @@
;; Initialize IM encoding
(uim-im-init)
+ ;; override some functions
+ (uim-this-command-keys-override)
+
(if (not buffer-read-only)
(progn
@@ -423,10 +426,12 @@
;; update mode-line
(force-mode-line-update)
-
;; Disable uim-mode
(setq uim-mode nil)
+ ;; restore original functions
+ (uim-this-command-keys-restore)
+
(uim-debug (format "uim-mode: %s" uim-mode))
)
@@ -1548,9 +1553,6 @@
;; initialize keymap
(uim-init-keymap)
-
- ;; wrap some functions
- (uim-this-command-keys-override)
;; add hook to detect status change of buffer
(add-hook 'post-command-hook 'uim-post-command)