1 ;;; nabe.el --- Boiled-Egg like roman to kanaji converter kernel
3 ;; Copyright (C) 1996 MORIOKA Tomohiko
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
6 ;; Version: $Id: nabe.el,v 0.5 1996/11/12 09:03:23 morioka Exp $
7 ;; Keywords: input, Japanese, mule
9 ;; This file is not part of GNU Emacs.
11 ;; This program is free software; you can redistribute it and/or
12 ;; modify it under the terms of the GNU General Public License as
13 ;; published by the Free Software Foundation; either version 2, or (at
14 ;; your option) any later version.
16 ;; This program is distributed in the hope that it will be useful, but
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 ;; General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA.
28 (defvar nabe-characters-to-translate "-a-zA-Z0-9.,?!~()[]#@/:;%"
29 "*characters to transfer. [nabe.el]")
31 (defvar nabe-kanji-key "\e ")
32 (defvar nabe-hiragana-key "\en")
34 (defvar nabe-roman-to-kanji-function nil)
35 (defvar nabe-roman-to-kana-function nil)
37 (global-set-key nabe-kanji-key 'nabe-translate-to-kanji)
38 (global-set-key nabe-hiragana-key 'nabe-translate-to-hiragana)
40 (defun nabe-translate-to-kanji (arg)
42 (let ((po (point)) (mark (or (mark t) 0)))
43 (skip-chars-backward nabe-characters-to-translate)
44 (if (and mark (< mark po) (< (point) mark))
47 (if (not (eq (point) po))
48 (funcall nabe-roman-to-kanji-function (point) po)
50 (and auto-fill-function (funcall auto-fill-function))
53 (defun nabe-translate-to-hiragana (arg)
55 (let ((po (point)) (mark (or (mark t) 0)))
56 (skip-chars-backward nabe-characters-to-translate)
57 (if (and mark (< mark po) (< (point) mark))
60 (if (not (eq (point) po))
62 (narrow-to-region (point) po)
63 (funcall nabe-roman-to-kana-function (point) po)
64 (goto-char (point-max))
66 (and auto-fill-function (funcall auto-fill-function))
75 (run-hooks 'nabe-load-hook)