;;; canna.el --- Interface to the Canna input method.
;; Copyright (C) 1994 Akira Kon, NEC Corporation.
-;; Copyright (C) 1996,1997,1998 MORIOKA Tomohiko
+;; Copyright (C) 1996,1997,1998,2004 MORIOKA Tomohiko
;; Copyright (C) 1997 Stephen Turnbull
;; Author: Akira Kon <kon@d1.bs2.mt.nec.co.jp>
;; MORIOKA Tomohiko <morioka@jaist.ac.jp>
;; Stephen Turnbull <turnbull@sk.tsukuba.ac.jp>
-;; Version: $Revision: 1.16 $
+;; Version: $Revision: 1.21 $
;; Keywords: Canna, Japanese, input method, mule, multilingual
;; This file is part of Emacs-Canna.
(require 'poem)
-(eval-and-compile
- (defvar canna-dl-module
- (expand-file-name "canna.so" exec-directory))
+(defvar canna-dl-module
+ (expand-file-name "canna.so" exec-directory))
- (defvar canna-dl-handle
- (and (not (boundp 'CANNA))
- (fboundp 'dynamic-link)
- (dynamic-link canna-dl-module)))
-
- (and canna-dl-handle
- (dynamic-call "emacs_canna_init" canna-dl-handle))
- )
+(defvar canna-dl-handle
+ (and (not (boundp 'CANNA))
+ (fboundp 'dynamic-link)
+ (dynamic-link canna-dl-module)))
+
+(and canna-dl-handle
+ (dynamic-call "emacs_canna_init" canna-dl-handle))
(or (boundp 'CANNA)
(featurep 'CANNA)
;; (defalias 'self-insert-internal 'self-insert-command)
;; end
-(defconst canna-rcs-version
- "$Id: canna.el,v 1.16 1998-10-21 06:36:55 morioka Exp $")
+(defconst canna-version "Emacs-Canna 1.3")
(defun canna-version ()
"Display version of canna.el in mini-buffer."
(interactive)
- (message (concat
- (substring canna-rcs-version
- 5
- (if (string-match "[0-9] [a-z]" canna-rcs-version)
- (1+ (match-beginning 0))
- ))
- " ...")))
-
-(if (featurep 'xemacs)
- (defun canna-self-insert-string (string)
- (let ((len (length string))
- (i 0)
- ;; \e$BA^F~$NESCf$G\e(B blink \e$B$,5/$-$k$H$&$C$H$*$7$$$N$G!"\e(B
- ;; \e$B0l;~E*$K\e(B blink \e$B$rM^;_$9$k!#\e(B
- (blink-matching-paren nil))
- (while (< i len)
- (self-insert-internal (aref canna-kakutei-string i))
- (setq i (1+ i))
- )))
- (defalias 'canna-self-insert-string 'insert)
+ (message (concat canna-version " ...")))
+
+(cond
+ ((featurep 'xemacs)
+ (defvar canna-self-insert-string-filter (function identity))
+ (defun canna-self-insert-string (string)
+ (if (fboundp canna-self-insert-string-filter)
+ (setq string (funcall canna-self-insert-string-filter string)))
+ (let ((len (length string))
+ (i 0)
+ ;; \e$BA^F~$NESCf$G\e(B blink \e$B$,5/$-$k$H$&$C$H$*$7$$$N$G!"\e(B
+ ;; \e$B0l;~E*$K\e(B blink \e$B$rM^;_$9$k!#\e(B
+ (blink-matching-paren nil))
+ (while (< i len)
+ (self-insert-internal (aref string i))
+ (setq i (1+ i)))))
)
+ (t
+ (defalias 'canna-self-insert-string 'insert)
+ ))
;;; \e$B$+$s$J$NJQ?t\e(B
(canna:memq-recursive a (cdr l)) )))
(defun canna:create-mode-line ()
- "Add string of Canna status into mode-line."
+ "Add Canna status string into mode-line."
(cond ((featurep 'xemacs)
(or (canna:memq-recursive 'mode-line-canna-mode
default-modeline-format)
(setq-default default-modeline-format
- (nconc '("" mode-line-canna-mode)
- default-modeline-format))
+ (append '("" mode-line-canna-mode)
+ default-modeline-format))
)
(mapcar (function
(lambda (buffer)
(or (canna:memq-recursive 'mode-line-canna-mode
modeline-format)
(setq modeline-format
- (nconc '("" mode-line-canna-mode)
- modeline-format))
+ (append '("" mode-line-canna-mode)
+ modeline-format))
)
)))
(buffer-list))
(make-variable-buffer-local (defvar canna:*select-overlay* nil))
;;;
-;;; \e$B%-!<%^%C%W%F!<%V%k\e(B
+;;; Keymap table
;;;
-;; \e$B%U%'%s%9%b!<%I$G$N%m!<%+%k%^%C%W\e(B
+;; Fence mode local map
(defvar canna-mode-map (make-sparse-keymap))
(let ((ch 0))
;;;
(defun canna-functional-insert-command (arg)
- "Use input character as a key of complex translation input such as\n\
+ "Use input character as a key of complex translation input such as
kana-to-kanji translation."
(interactive "*p")
(let ((ch))
(canna:functional-insert-command2 ch arg) ))
(defun canna:functional-insert-command2 (ch arg)
- "This function actualy isert a converted Japanese string."
+ "This function actually inserts a converted Japanese string."
;; \e$B$3$N4X?t$OM?$($i$l$?J8;z$rF|K\8lF~NO$N$?$a$N%-!<F~NO$H$7$F<h$j07\e(B
;; \e$B$$!"F|K\8lF~NO$NCf4V7k2L$r4^$a$?=hM}$r\e(BEmacs\e$B$N%P%C%U%!$KH?1G$5$;$k\e(B
;; \e$B4X?t$G$"$k!#\e(B
;;; canna-functional-insert-command \e$B$r8F$V!#\e(B
;;;
-(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."
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))
(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*))
))
)))
(defun canna-touroku-region (start end)
- "Register a word which is indicated by region into a kana-to-kanji\n\
-dictionary."
+ "Register a word in the selected region into a kana-to-kanji dictionary."
(interactive "r")
(if (canna-without-newline start end)
; (if canna:*japanese-mode*
;;;
(defun canna-set-mark-command (arg)
- "Besides setting mark, set mark as a HENKAN region if it is in\n\
-the japanese mode."
+ "Set mark, also set mark as HENKAN region if in Japanese mode."
(interactive "P")
(set-mark-command arg)
(if canna:*japanese-mode*
(message "Mark set(\e$BJQ49NN0h3+;O\e(B)") )))
(defun canna-henkan-region-or-self-insert (arg)
- "Do kana-to-kanji convert region if HENKAN region is defined,\n\
-self insert otherwise."
+ "Do kana-to-kanji convert region if HENKAN region is defined, else insert."
(interactive "*p")
(if (and canna:*use-region-as-henkan-region*
; (< (mark) (point))