Merge canna.el of XEmacs package.
authormorioka <morioka>
Mon, 9 Feb 1998 12:20:22 +0000 (12:20 +0000)
committermorioka <morioka>
Mon, 9 Feb 1998 12:20:22 +0000 (12:20 +0000)
canna.el

index 3d8683b..49ef784 100644 (file)
--- a/canna.el
+++ b/canna.el
@@ -5,7 +5,8 @@
 
 ;; Author: Akira Kon <kon@d1.bs2.mt.nec.co.jp>
 ;;         MORIOKA Tomohiko <morioka@jaist.ac.jp>
 
 ;; Author: Akira Kon <kon@d1.bs2.mt.nec.co.jp>
 ;;         MORIOKA Tomohiko <morioka@jaist.ac.jp>
-;; Version: $Revision: 1.12 $
+;;         Stephen Turnbull <turnbull@sk.tsukuba.ac.jp>
+;; Version: $Revision: 1.13 $
 ;; Keywords: Canna, Japanese, input method, mule, multilingual
 
 ;; This file is not a part of Emacs yet.
 ;; Keywords: Canna, Japanese, input method, mule, multilingual
 
 ;; This file is not a part of Emacs yet.
@@ -54,7 +55,7 @@
 ;; end
 
 (defconst canna-rcs-version
 ;; end
 
 (defconst canna-rcs-version
-  "$Id: canna.el,v 1.12 1998-02-09 12:03:47 morioka Exp $")
+  "$Id: canna.el,v 1.13 1998-02-09 12:20:22 morioka Exp $")
 
 (defun canna-version ()
   "Display version of canna.el in mini-buffer."
 
 (defun canna-version ()
   "Display version of canna.el in mini-buffer."
 
 (defun canna:create-mode-line ()
   "Add string of Canna status into mode-line."
 
 (defun canna:create-mode-line ()
   "Add string of Canna status into mode-line."
-  (cond (running-xemacs
+  (cond ((featurep 'xemacs)
         (or (canna:memq-recursive 'mode-line-canna-mode
                                   default-modeline-format)
             (setq-default default-modeline-format
         (or (canna:memq-recursive 'mode-line-canna-mode
                                   default-modeline-format)
             (setq-default default-modeline-format
@@ -290,7 +291,7 @@ t \e$B$N;~$O%G%U%)%k%H$N?'$r;HMQ$9$k!#\e(B
     (define-key canna-mode-map (make-string 1 ch) 'canna-functional-insert-command)
     (setq ch (1+ ch))))
 
     (define-key canna-mode-map (make-string 1 ch) 'canna-functional-insert-command)
     (setq ch (1+ ch))))
 
-(cond (running-xemacs
+(cond ((featurep 'xemacs)
        (define-key canna-mode-map [up]             "\C-p")
        (define-key canna-mode-map [(shift up)]      "\C-p")
        (define-key canna-mode-map [(control up)]    "\C-p")
        (define-key canna-mode-map [up]             "\C-p")
        (define-key canna-mode-map [(shift up)]      "\C-p")
        (define-key canna-mode-map [(control up)]    "\C-p")
@@ -331,7 +332,7 @@ t \e$B$N;~$O%G%U%)%k%H$N?'$r;HMQ$9$k!#\e(B
     (define-key canna-minibuffer-mode-map (make-string 1 ch) 'canna-minibuffer-insert-command)
     (setq ch (1+ ch))))
 
     (define-key canna-minibuffer-mode-map (make-string 1 ch) 'canna-minibuffer-insert-command)
     (setq ch (1+ ch))))
 
-(cond (running-xemacs
+(cond ((featurep 'xemacs)
        (define-key canna-minibuffer-mode-map [up]              "\C-p")
        (define-key canna-minibuffer-mode-map [(shift up)]      "\C-p")
        (define-key canna-minibuffer-mode-map [(control up)]    "\C-p")
        (define-key canna-minibuffer-mode-map [up]              "\C-p")
        (define-key canna-minibuffer-mode-map [(shift up)]      "\C-p")
        (define-key canna-minibuffer-mode-map [(control up)]    "\C-p")
@@ -640,7 +641,7 @@ kana-to-kanji translation."
 ;      (set-window-buffer (minibuffer-window)
 ;                         (get-buffer-create canna:*menu-buffer*))
        ;; modified by \e$B<i2,\e(B \e$BCNI'\e(B <morioka@jaist.ac.jp>, 1996/6/7
 ;      (set-window-buffer (minibuffer-window)
 ;                         (get-buffer-create canna:*menu-buffer*))
        ;; modified by \e$B<i2,\e(B \e$BCNI'\e(B <morioka@jaist.ac.jp>, 1996/6/7
-       (unless running-xemacs
+       (unless (featurep 'xemacs)
          ;; \e$B$H$j$"$($:\e(B XEmacs \e$B$G$OF0$+$5$J$$$3$H$K$7$F$*$3$&\e(B (^_^;
          (setq canna:*saved-redirection* (frame-focus (selected-frame)))
          (redirect-frame-focus (selected-frame) 
          ;; \e$B$H$j$"$($:\e(B XEmacs \e$B$G$OF0$+$5$J$$$3$H$K$7$F$*$3$&\e(B (^_^;
          (setq canna:*saved-redirection* (frame-focus (selected-frame)))
          (redirect-frame-focus (selected-frame) 
@@ -686,7 +687,7 @@ kana-to-kanji translation."
        (set-window-buffer (minibuffer-window) canna:*saved-minibuffer*)
 ;      (setq canna:*saved-minibuffer* nil)
        ;; modified by \e$B<i2,\e(B \e$BCNI'\e(B <morioka@jaist.ac.jp>, 1996/6/7
        (set-window-buffer (minibuffer-window) canna:*saved-minibuffer*)
 ;      (setq canna:*saved-minibuffer* nil)
        ;; modified by \e$B<i2,\e(B \e$BCNI'\e(B <morioka@jaist.ac.jp>, 1996/6/7
-       (unless running-xemacs
+       (unless (featurep 'xemacs)
          ;; \e$B$H$j$"$($:\e(B XEmacs \e$B$G$OF0$+$5$J$$$h$&$K$7$F$*$3$&\e(B (^_^;
          (redirect-frame-focus (window-frame canna:*previous-window*)
                                canna:*saved-redirection*)
          ;; \e$B$H$j$"$($:\e(B XEmacs \e$B$G$OF0$+$5$J$$$h$&$K$7$F$*$3$&\e(B (^_^;
          (redirect-frame-focus (window-frame canna:*previous-window*)
                                canna:*saved-redirection*)
@@ -1002,7 +1003,7 @@ dictionary."
                              (eq hilit-background-mode 'dark))
                         (string-match
                          "on\\|t"
                              (eq hilit-background-mode 'dark))
                         (string-match
                          "on\\|t"
-                         (or (if running-xemacs
+                         (or (if (featurep 'xemacs)
                                  (x-get-resource "ReverseVideo"
                                                  "reverseVideo" 'string)
                                (x-get-resource "ReverseVideo" "reverseVideo"))
                                  (x-get-resource "ReverseVideo"
                                                  "reverseVideo" 'string)
                                (x-get-resource "ReverseVideo" "reverseVideo"))
@@ -1059,7 +1060,14 @@ dictionary."
               (define-key global-map (make-string 1 ch) 'canna-self-insert-command)
               (setq ch (1+ ch)) ))
 
               (define-key global-map (make-string 1 ch) 'canna-self-insert-command)
               (setq ch (1+ ch)) ))
 
-          (cond ((let ((keys (car init-val)) (ok nil))
+          (cond
+           ;; #### I'm just guessing that this should come before the
+           ;;      init-val setting
+           ;; if registered with LEIM, no-op
+           ((featurep 'canna-leim) t)
+           ;; check to see if an X resource or the like is available in
+           ;; init-val
+           ((let ((keys (car init-val)) (ok nil))
                    (while keys
                      (cond ((< (car keys) 128)
                             (global-set-key
                    (while keys
                      (cond ((< (car keys) 128)
                             (global-set-key
@@ -1068,9 +1076,13 @@ dictionary."
                             (setq ok t) ))
                      (setq keys (cdr keys))
                      ) ok))
                             (setq ok t) ))
                      (setq keys (cdr keys))
                      ) ok))
-                (t ; \e$B%G%U%)%k%H$N@_Dj\e(B
-                 (global-set-key "\C-o" 'canna-toggle-japanese-mode) ))
+           ;; \e$B%G%U%)%k%H$N@_Dj\e(B
+           ;; Since XEmacs provides canna-leim.el, we should leave this
+           ;; as is.
+           (t (global-set-key "\C-o" 'canna-toggle-japanese-mode) ))
 
 
+          ;; #### should these global bindings be conditional on LEIM?
+           ;;      LEIM doesn't use kanji key yet AFAIK, so leave them.
           (if (not (keymapp (global-key-binding "\e[")))
               (global-unset-key "\e[") )
           (global-set-key "\e[210z" 'canna-toggle-japanese-mode) ; XFER
           (if (not (keymapp (global-key-binding "\e[")))
               (global-unset-key "\e[") )
           (global-set-key "\e[210z" 'canna-toggle-japanese-mode) ; XFER