-;; This file is a part of Canna on Nemacs/Mule.
+;;; canna.el --- Interface to the Canna input method.
-;; Canna on Nemacs/Mule is distributed in the forms of
-;; patches to Nemacs under the terms of the GNU EMACS
-;; GENERAL PUBLIC LICENSE which is distributed along with
-;; GNU Emacs by the Free Software Foundation.
+;; Copyright (C) 1994 Akira Kon, NEC Corporation.
+;; Copyright (C) 1996,1997,1998,2004 MORIOKA Tomohiko
+;; Copyright (C) 1997 Stephen Turnbull
-;; Canna on Nemacs/Mule is distributed in the hope that it will
-;; be useful, but WITHOUT ANY WARRANTY; without even the
-;; implied warranty of MERCHANTABILITY or FITNESS FOR A
-;; PARTICULAR PURPOSE. See the GNU EMACS GENERAL PUBLIC
-;; LICENSE for more details.
+;; 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.21 $
+;; Keywords: Canna, Japanese, input method, mule, multilingual
-;; You should have received a copy of the GNU EMACS GENERAL
-;; PUBLIC LICENSE along with Nemacs/Mule; see the file
-;; COPYING. If not, write to the Free Software Foundation,
-;; 675 Mass Ave, Cambridge, MA 02139, USA.
+;; This file is part of Emacs-Canna.
-;; Egg offered some influences to the implementation of
-;; Canna on Nemacs/Mule, and this file contains a few part
-;; of Egg which is written by S.Tomura, Electrotechnical
-;; Lab. (tomura@etl.go.jp)
+;; This program is free software; you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation; either version 2, or (at
+;; your option) any later version.
-;; Written by Akira Kon, NEC Corporation.
-;; E-Mail: kon@d1.bs2.mt.nec.co.jp.
+;; This program is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;; General Public License for more details.
-;; -*-mode: emacs-lisp-*-
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING. If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
-(defconst canna-rcs-version "Canna/mule 2.x, based on Canna 2.2/3.2. : canna.el,v x.xx 1994/11/7 00:00:00")
+;;; Commentary:
+
+;; Egg offered some influences to the implementation of Canna on
+;; Nemacs/Mule, and this file contains a few part of Egg which is
+;; written by S.Tomura, Electrotechnical Lab. (tomura@etl.go.jp)
+
+;; This program is rewritten for Emacs/mule and XEmacs/mule by MORIOKA
+;; Tomohiko.
+
+;;; Code:
+
+(require 'poem)
+
+(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))
+
+(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-version "Emacs-Canna 1.3")
(defun canna-version ()
+ "Display version of canna.el in mini-buffer."
(interactive)
- (message (concat (substring canna-rcs-version 0 72) " ...")) )
+ (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)
+ ))
-(provide 'canna)
;;; \e$B$+$s$J$NJQ?t\e(B
(canna:memq-recursive a (cdr l)) )))
(defun canna:create-mode-line ()
- (if (not (canna:memq-recursive 'mode-line-canna-mode mode-line-format))
- (setq-default
- mode-line-format
- (append (list (list 'minibuffer-window-selected
- (list 'display-minibuffer-mode-in-minibuffer
- "-" "m") "-")
- (list 'minibuffer-window-selected
- (list 'display-minibuffer-mode-in-minibuffer
- 'mode-line-canna-mode
- 'mode-line-canna-mode-in-minibuffer)
- 'mode-line-canna-mode))
- mode-line-format)))
- (mode-line-canna-mode-update mode-line-canna-mode) )
+ "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
+ (append '("" mode-line-canna-mode)
+ default-modeline-format))
+ )
+ (mapcar (function
+ (lambda (buffer)
+ (save-excursion
+ (set-buffer buffer)
+ (or (canna:memq-recursive 'mode-line-canna-mode
+ modeline-format)
+ (setq modeline-format
+ (append '("" mode-line-canna-mode)
+ modeline-format))
+ )
+ )))
+ (buffer-list))
+ )
+ (t
+ (or (canna:memq-recursive 'mode-line-canna-mode mode-line-format)
+ (setq-default
+ mode-line-format
+ (append (list (list 'minibuffer-window-selected
+ (list 'display-minibuffer-mode-in-minibuffer
+ "-" "m") "-")
+ (list 'minibuffer-window-selected
+ (list 'display-minibuffer-mode-in-minibuffer
+ 'mode-line-canna-mode
+ 'mode-line-canna-mode-in-minibuffer)
+ 'mode-line-canna-mode))
+ mode-line-format))
+ )))
+ (mode-line-canna-mode-update mode-line-canna-mode))
(defun canna:mode-line-display ()
(mode-line-canna-mode-update mode-line-canna-mode))
(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))
(define-key canna-mode-map (make-string 1 ch) 'canna-functional-insert-command)
(setq ch (1+ ch))))
-(define-key canna-mode-map [up] [?\C-p])
-(define-key canna-mode-map [S-up] [?\C-p])
-(define-key canna-mode-map [C-up] [?\C-p])
-(define-key canna-mode-map [down] [?\C-n])
-(define-key canna-mode-map [S-down] [?\C-n])
-(define-key canna-mode-map [C-down] [?\C-n])
-(define-key canna-mode-map [right] [?\C-f])
-(define-key canna-mode-map [S-right] [?\C-f])
-(define-key canna-mode-map [C-right] [?\C-f])
-(define-key canna-mode-map [left] [?\C-b])
-(define-key canna-mode-map [S-left] [?\C-b])
-(define-key canna-mode-map [C-left] [?\C-b])
-(define-key canna-mode-map [kanji] [? ])
-(define-key canna-mode-map [?\C- ] [?\C-@])
+(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 [down] "\C-n")
+ (define-key canna-mode-map [(shift down)] "\C-n")
+ (define-key canna-mode-map [(control down)] "\C-n")
+ (define-key canna-mode-map [right] "\C-f")
+ (define-key canna-mode-map [(shift right)] "\C-f")
+ (define-key canna-mode-map [(control right)] "\C-f")
+ (define-key canna-mode-map [left] "\C-b")
+ (define-key canna-mode-map [(shift left)] "\C-b")
+ (define-key canna-mode-map [(control left)] "\C-b")
+ (define-key canna-mode-map [kanji] " ")
+ (define-key canna-mode-map [(control space)] [(control @)])
+ )
+ (t
+ (define-key canna-mode-map [up] [?\C-p])
+ (define-key canna-mode-map [S-up] [?\C-p])
+ (define-key canna-mode-map [C-up] [?\C-p])
+ (define-key canna-mode-map [down] [?\C-n])
+ (define-key canna-mode-map [S-down] [?\C-n])
+ (define-key canna-mode-map [C-down] [?\C-n])
+ (define-key canna-mode-map [right] [?\C-f])
+ (define-key canna-mode-map [S-right] [?\C-f])
+ (define-key canna-mode-map [C-right] [?\C-f])
+ (define-key canna-mode-map [left] [?\C-b])
+ (define-key canna-mode-map [S-left] [?\C-b])
+ (define-key canna-mode-map [C-left] [?\C-b])
+ (define-key canna-mode-map [kanji] [? ])
+ (define-key canna-mode-map [?\C- ] [?\C-@])
+ ))
;; \e$B%_%K%P%C%U%!$K2?$+$rI=<($7$F$$$k;~$N%m!<%+%k%^%C%W\e(B
(defvar canna-minibuffer-mode-map (make-sparse-keymap))
(define-key canna-minibuffer-mode-map (make-string 1 ch) 'canna-minibuffer-insert-command)
(setq ch (1+ ch))))
-(define-key canna-minibuffer-mode-map [up] [?\C-p])
-(define-key canna-minibuffer-mode-map [S-up] [?\C-p])
-(define-key canna-minibuffer-mode-map [C-up] [?\C-p])
-(define-key canna-minibuffer-mode-map [down] [?\C-n])
-(define-key canna-minibuffer-mode-map [S-down] [?\C-n])
-(define-key canna-minibuffer-mode-map [C-down] [?\C-n])
-(define-key canna-minibuffer-mode-map [right] [?\C-f])
-(define-key canna-minibuffer-mode-map [S-right] [?\C-f])
-(define-key canna-minibuffer-mode-map [C-right] [?\C-f])
-(define-key canna-minibuffer-mode-map [left] [?\C-b])
-(define-key canna-minibuffer-mode-map [S-left] [?\C-b])
-(define-key canna-minibuffer-mode-map [C-left] [?\C-b])
-(define-key canna-minibuffer-mode-map [kanji] [? ])
-(define-key canna-minibuffer-mode-map [?\C- ] [?\C-@])
+(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 [down] "\C-n")
+ (define-key canna-minibuffer-mode-map [(shift down)] "\C-n")
+ (define-key canna-minibuffer-mode-map [(control down)] "\C-n")
+ (define-key canna-minibuffer-mode-map [right] "\C-f")
+ (define-key canna-minibuffer-mode-map [(shift right)] "\C-f")
+ (define-key canna-minibuffer-mode-map [(control right)] "\C-f")
+ (define-key canna-minibuffer-mode-map [left] "\C-b")
+ (define-key canna-minibuffer-mode-map [(shift left)] "\C-b")
+ (define-key canna-minibuffer-mode-map [(control left)] "\C-b")
+ (define-key canna-minibuffer-mode-map [kanji] " ")
+ (define-key canna-minibuffer-mode-map [(control space)] [(control @)])
+ )
+ (t
+ (define-key canna-minibuffer-mode-map [up] [?\C-p])
+ (define-key canna-minibuffer-mode-map [S-up] [?\C-p])
+ (define-key canna-minibuffer-mode-map [C-up] [?\C-p])
+ (define-key canna-minibuffer-mode-map [down] [?\C-n])
+ (define-key canna-minibuffer-mode-map [S-down] [?\C-n])
+ (define-key canna-minibuffer-mode-map [C-down] [?\C-n])
+ (define-key canna-minibuffer-mode-map [right] [?\C-f])
+ (define-key canna-minibuffer-mode-map [S-right] [?\C-f])
+ (define-key canna-minibuffer-mode-map [C-right] [?\C-f])
+ (define-key canna-minibuffer-mode-map [left] [?\C-b])
+ (define-key canna-minibuffer-mode-map [S-left] [?\C-b])
+ (define-key canna-minibuffer-mode-map [C-left] [?\C-b])
+ (define-key canna-minibuffer-mode-map [kanji] [? ])
+ (define-key canna-minibuffer-mode-map [?\C- ] [?\C-@])
+ ))
;;;
;;; \e$B%0%m!<%P%k4X?t$N=q$-BX$(\e(B
;;;
(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")
- (canna:functional-insert-command2 last-command-char arg) )
+ (let ((ch))
+ (if (char-or-char-int-p arg)
+ (setq ch last-command-char)
+ (setq ch (event-to-character last-command-event)))
+ (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
(set-marker canna:*spos-undo-text* (point))
;;
;; update kbnes
- (let ((list (string-to-char-list canna-kakutei-string))
- ;; \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 list
- (self-insert-internal (car list))
- (setq list (cdr list))))
+ (canna-self-insert-string canna-kakutei-string)
;; \e$BL$3NDj$NJ8;z$,$J$/!"3NDjJ8;zNs$N:G8e$,JD$83g8L$N\e(B
;; \e$BN`$@$C$?$H$-$O\e(B blink \e$B$5$;$k!#\e(B
(if (and canna-empty-info
(t
;;
;; update kbnes
- (let ((list (string-to-char-list canna-kakutei-string))
- ;; \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 list
- (self-insert-internal (car list))
- (setq list (cdr list))))
+ (canna-self-insert-string canna-kakutei-string)
;; \e$BL$3NDj$NJ8;z$,$J$/!"3NDjJ8;zNs$N:G8e$,JD$83g8L$N\e(B
;; \e$BN`$@$C$?$H$-$O\e(B blink \e$B$5$;$k!#\e(B
(if (and canna-empty-info
(canna:yomi-attr-on canna:*region-start* canna:*region-end*))
(setq canna:*last-kouho* canna-henkan-length)
))
-
- ;; \e$B8uJdNN0h$G$O6/D4$7$?$$J8;zNs$,B8:_$9$k$b$N$H9M$($i\e(B
- ;; \e$B$l$k!#6/D4$7$?$$J8;z$O\e(BEmacs\e$B$G$O%+!<%=%k%]%8%7%g%s$K$FI=<(\e(B
- ;; \e$B$9$k$3$H$H$9$k!#6/D4$7$?$$J8;z$,$J$$$N$G$"$l$P!"%+!<%=%k\e(B
- ;; \e$B$O0lHV8e$NItJ,\e(B(\e$BF~NO$,9T$o$l$k%]%$%s%H\e(B)\e$B$KCV$$$F$*$/!#\e(B
-
- ;; \e$B%+!<%=%k$r0\F0$9$k!#\e(B
- (if (not canna-underline)
- (backward-char
- (- canna:*last-kouho*
- ;; \e$B%+!<%=%k0LCV$O!"H?E>I=<(ItJ,$,B8:_$7$J$$$N$G$"$l$P!"\e(B
- ;; \e$B8uJdJ8;zNs$N:G8e$NItJ,$H$7!"H?E>I=<(ItJ,$,B8:_$9$k$N\e(B
- ;; \e$B$G$"$l$P!"$=$NItJ,$N;O$a$H$9$k!#\e(B
- (cond ((zerop canna-henkan-revlen)
- canna:*last-kouho*)
- (t canna-henkan-revpos) )) )
- (if (and (> canna-henkan-revlen 0)
- (> canna-henkan-length 0))
- ; \e$B8uJd$ND9$5$,\e(B0\e$B$G$J$/!"\e(B
- ; \e$BH?E>I=<($ND9$5$,\e(B0\e$B$G$J$1$l$P!"\e(B
- ; \e$B$=$NItJ,$rJQE>I=<($9$k!#\e(B
- (let ((start (+ canna:*region-start*
- (if canna-with-fences 1 0)
- canna-henkan-revpos) ))
- (if canna-underline
- (canna:henkan-attr-on start
- (+ start canna-henkan-revlen)))))
- ) )
+
+ ;; \e$B8uJdNN0h$G$O6/D4$7$?$$J8;zNs$,B8:_$9$k$b$N$H9M$($i\e(B
+ ;; \e$B$l$k!#6/D4$7$?$$J8;z$O\e(BEmacs\e$B$G$O%+!<%=%k%]%8%7%g%s$K$FI=<(\e(B
+ ;; \e$B$9$k$3$H$H$9$k!#6/D4$7$?$$J8;z$,$J$$$N$G$"$l$P!"%+!<%=%k\e(B
+ ;; \e$B$O0lHV8e$NItJ,\e(B(\e$BF~NO$,9T$o$l$k%]%$%s%H\e(B)\e$B$KCV$$$F$*$/!#\e(B
+
+ ;; \e$B%+!<%=%k$r0\F0$9$k!#\e(B
+ (if (not canna-underline)
+ (backward-char
+ (- canna:*last-kouho*
+ ;; \e$B%+!<%=%k0LCV$O!"H?E>I=<(ItJ,$,B8:_$7$J$$$N$G$"$l$P!"\e(B
+ ;; \e$B8uJdJ8;zNs$N:G8e$NItJ,$H$7!"H?E>I=<(ItJ,$,B8:_$9$k$N\e(B
+ ;; \e$B$G$"$l$P!"$=$NItJ,$N;O$a$H$9$k!#\e(B
+ (cond ((zerop canna-henkan-revlen)
+ canna:*last-kouho*)
+ (t canna-henkan-revpos) )) )
+ (if (and (> canna-henkan-revlen 0)
+ (> canna-henkan-length 0))
+ ; \e$B8uJd$ND9$5$,\e(B0\e$B$G$J$/!"\e(B
+ ; \e$BH?E>I=<($ND9$5$,\e(B0\e$B$G$J$1$l$P!"\e(B
+ ; \e$B$=$NItJ,$rJQE>I=<($9$k!#\e(B
+ (let ((start (+ canna:*region-start*
+ (if canna-with-fences 1 0)
+ canna-henkan-revpos) ))
+ (if canna-underline
+ (canna:henkan-attr-on start
+ (+ start canna-henkan-revlen)))))
+ ) )
(defun canna:display-candidates (strs)
(cond ((stringp strs) ; \e$B%(%i!<$,5/$3$C$?>l9g\e(B
(setq canna:*saved-minibuffer* (window-buffer (minibuffer-window)))
; (set-window-buffer (minibuffer-window)
; (get-buffer-create canna:*menu-buffer*))
- (setq canna:*saved-redirection* (frame-focus (selected-frame)))
- (redirect-frame-focus (selected-frame)
- (window-frame (minibuffer-window)))
-
+ ;; modified by \e$B<i2,\e(B \e$BCNI'\e(B <morioka@jaist.ac.jp>, 1996/6/7
+ (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)
+ (window-frame (minibuffer-window)))
+ )
;; \e$B%_%K%P%C%U%!$N%-!<%^%C%W$rJ]B8$7$F$*$/!#\e(B
(setq canna:*minibuffer-local-map-backup* (current-local-map))
))
;; \e$B%_%K%P%C%U%!%&%#%s%I%&$N%P%C%U%!$r85$KLa$9!#\e(B
(set-window-buffer (minibuffer-window) canna:*saved-minibuffer*)
; (setq canna:*saved-minibuffer* nil)
- (redirect-frame-focus (window-frame canna:*previous-window*)
- canna:*saved-redirection*)
+ ;; modified by \e$B<i2,\e(B \e$BCNI'\e(B <morioka@jaist.ac.jp>, 1996/6/7
+ (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%_%K%P%C%U%!$GF~NO$7$F$$$?$N$J$i0J2<$b$9$k!#\e(B
; (if (eq canna:*previous-window* (selected-window))
; (progn
(use-local-map canna:*minibuffer-local-map-backup*)
(set-window-buffer (minibuffer-window) canna:*saved-minibuffer*)
(select-window canna:*previous-window*)
- (canna:functional-insert-command2 last-command-char arg) )
+ (let ((ch))
+ (if (char-or-char-int-p arg)
+ (setq ch last-command-char)
+ (setq ch (event-to-character last-command-event)))
+ (canna:functional-insert-command2 ch arg) ))
;;;
;;; \e$B$+$s$J%b!<%I$N<gLr$O!"<!$N\e(B canna-self-insert-command \e$B$G$"$k!#$3$N\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."
(- (point) arg) (point)))
(if (= last-command-char ? ) (canna:do-auto-fill))))))
+;; wire us into pending-delete
+(put 'canna-self-insert-command 'pending-delete t)
+
(defun canna-toggle-japanese-mode ()
"Toggle canna japanese mode."
(interactive)
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)
- (if (boundp 'disable-undo)
- (setq disable-undo canna:*fence-mode*))
- (use-local-map canna-mode-map) )
+ ;; XEmacs change:
+ ;; (buffer-disable-undo (current-buffer))
+ ;; Original:
+ ;; (if (boundp 'disable-undo)
+ ;; (setq disable-undo canna:*fence-mode*))
+ (use-local-map canna-mode-map))
(defun canna:enter-canna-mode-and-functional-insert ()
(canna:enter-canna-mode)
(if canna:*japanese-mode*
(canna-toggle-japanese-mode)
(mode-line-canna-mode-update canna:*alpha-mode-string*) )))
- (if (boundp 'disable-undo)
- (setq disable-undo canna:*fence-mode*))
+ ;; XEmacs change:
+ ;; (buffer-enable-undo (current-buffer))
+ ;; Original:
+ ;; (if (boundp 'disable-undo)
+ ;; (setq disable-undo canna:*fence-mode*))
))
(set-marker canna:*region-start* nil)
(set-marker canna:*region-end* nil)
)))
(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*
(eq hilit-background-mode 'dark))
(string-match
"on\\|t"
- (or (x-get-resource "ReverseVideo" "reverseVideo")
+ (or (if (featurep 'xemacs)
+ (x-get-resource "ReverseVideo"
+ "reverseVideo" 'string)
+ (x-get-resource "ReverseVideo" "reverseVideo"))
"")))
'reverse) ;\e$BH?E>$7$F$$$k$J$i\e(B 'reverse
(t 'normal)))
(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
(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
;;;
(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))
(defun canna:yomi-attr-on (start end)
(if (overlayp canna:*yomi-overlay*)
(move-overlay canna:*yomi-overlay* start end)
- (overlay-put (setq canna:*yomi-overlay* (make-overlay start end nil t))
+ (overlay-put (setq canna:*yomi-overlay* (make-overlay start end nil nil t))
'face
(if canna:color-p 'attr-yomi 'underline))
)
(defun canna:henkan-attr-on (start end)
(if (overlayp canna:*henkan-overlay*)
(move-overlay canna:*henkan-overlay* start end)
- (overlay-put (setq canna:*henkan-overlay* (make-overlay start end nil t))
+ (overlay-put (setq canna:*henkan-overlay*
+ (make-overlay start end nil nil t))
'face
(if canna:color-p 'attr-taishou 'region))
)
(defun canna:select-attr-on (start end)
(if (overlayp canna:*select-overlay*)
(move-overlay canna:*select-overlay* start end)
- (overlay-put (setq canna:*select-overlay* (make-overlay start end nil t))
+ (overlay-put (setq canna:*select-overlay*
+ (make-overlay start end nil nil t))
'face
'attr-select))
)
(delete-overlay canna:*select-overlay*)
)
)
+
+
+(provide 'canna)
+
+;;; canna.el ends here