X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=canna.el;h=b26a330cd290c4770544f65e140f64ffe3240487;hb=2220c00815d4c4f3c53b46e325386ac9517ea2e2;hp=3d8683bbd56ad908e10107b141287f388dca0126;hpb=5f42d23e2a0d5baf1b7e726b4bb1afe4ec8c223e;p=elisp%2Femacs-canna.git diff --git a/canna.el b/canna.el index 3d8683b..b26a330 100644 --- a/canna.el +++ b/canna.el @@ -2,13 +2,15 @@ ;; Copyright (C) 1994 Akira Kon, NEC Corporation. ;; Copyright (C) 1996,1997,1998 MORIOKA Tomohiko +;; Copyright (C) 1997 Stephen Turnbull ;; Author: Akira Kon ;; MORIOKA Tomohiko -;; Version: $Revision: 1.12 $ +;; Stephen Turnbull +;; Version: $Revision: 1.18 $ ;; Keywords: Canna, Japanese, input method, mule, multilingual -;; This file is not a part of Emacs yet. +;; This file is part of Emacs-Canna. ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License as @@ -36,7 +38,7 @@ ;;; Code: -;; -*-mode: emacs-lisp-*- +(require 'poem) (defvar canna-dl-module (expand-file-name "canna.so" exec-directory)) @@ -49,12 +51,16 @@ (and canna-dl-handle (dynamic-call "emacs_canna_init" canna-dl-handle)) +(or (boundp 'CANNA) + (featurep 'CANNA) + (error "Canna is not built into this Emacs")) + (defvar self-insert-after-hook nil) ;; (defalias 'self-insert-internal 'self-insert-command) ;; end (defconst canna-rcs-version - "$Id: canna.el,v 1.12 1998-02-09 12:03:47 morioka Exp $") + "$Id: canna.el,v 1.18 1998-10-27 09:59:18 morioka Exp $") (defun canna-version () "Display version of canna.el in mini-buffer." @@ -173,7 +179,7 @@ (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 @@ -290,7 +296,7 @@ t の時はデフォルトの色を使用する。 (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") @@ -331,7 +337,7 @@ t の時はデフォルトの色を使用する。 (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") @@ -640,7 +646,7 @@ kana-to-kanji translation." ; (set-window-buffer (minibuffer-window) ; (get-buffer-create canna:*menu-buffer*)) ;; modified by 守岡 知彦 , 1996/6/7 - (unless running-xemacs + (unless (featurep 'xemacs) ;; とりあえず XEmacs では動かさないことにしておこう (^_^; (setq canna:*saved-redirection* (frame-focus (selected-frame))) (redirect-frame-focus (selected-frame) @@ -686,7 +692,7 @@ kana-to-kanji translation." (set-window-buffer (minibuffer-window) canna:*saved-minibuffer*) ; (setq canna:*saved-minibuffer* nil) ;; modified by 守岡 知彦 , 1996/6/7 - (unless running-xemacs + (unless (featurep 'xemacs) ;; とりあえず XEmacs では動かさないようにしておこう (^_^; (redirect-frame-focus (window-frame canna:*previous-window*) canna:*saved-redirection*) @@ -727,8 +733,8 @@ kana-to-kanji translation, even if you are in the minibuffer." ;;; canna-functional-insert-command を呼ぶ。 ;;; -(if (not (boundp 'MULE)) ; for Nemacs - (defun cancel-undo-boundary ())) +;; (if (not (boundp 'MULE)) ; for Nemacs +;; (defun cancel-undo-boundary ())) (defun canna-self-insert-command (arg) "Self insert pressed key and use it to assemble Romaji character." @@ -844,10 +850,11 @@ kana-to-kanji translation, even if you are in the minibuffer." canna:*saved-mode-string* new-mode))) 0))) - (setq canna:*local-map-backup* (current-local-map)) + (setq canna:*local-map-backup* (current-local-map)) (setq canna:*fence-mode* t) ;; XEmacs change: - (buffer-disable-undo (current-buffer)) + ;; (buffer-disable-undo (current-buffer)) + ;; Original: ;; (if (boundp 'disable-undo) ;; (setq disable-undo canna:*fence-mode*)) (use-local-map canna-mode-map)) @@ -869,7 +876,8 @@ kana-to-kanji translation, even if you are in the minibuffer." (canna-toggle-japanese-mode) (mode-line-canna-mode-update canna:*alpha-mode-string*) ))) ;; XEmacs change: - (buffer-enable-undo (current-buffer)) + ;; (buffer-enable-undo (current-buffer)) + ;; Original: ;; (if (boundp 'disable-undo) ;; (setq disable-undo canna:*fence-mode*)) )) @@ -1002,7 +1010,7 @@ dictionary." (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")) @@ -1059,7 +1067,14 @@ dictionary." (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 @@ -1068,9 +1083,13 @@ dictionary." (setq ok t) )) (setq keys (cdr keys)) ) ok)) - (t ; デフォルトの設定 - (global-set-key "\C-o" 'canna-toggle-japanese-mode) )) + ;; デフォルトの設定 + ;; 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