;;; nabe.el --- Boiled-Egg like roman to kanaji converter kernel ;; Copyright (C) 1996 MORIOKA Tomohiko ;; Author: MORIOKA Tomohiko ;; Version: $Id: nabe.el,v 0.5 1996/11/12 09:03:23 morioka Exp $ ;; Keywords: input, Japanese, mule ;; This file is not part of GNU Emacs. ;; 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. ;; 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. ;; 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. ;;; Code: (defvar nabe-characters-to-translate "-a-zA-Z0-9.,?!~()[]#@/:;%" "*characters to transfer. [nabe.el]") (defvar nabe-kanji-key "\e ") (defvar nabe-hiragana-key "\en") (defvar nabe-roman-to-kanji-function nil) (defvar nabe-roman-to-kana-function nil) (global-set-key nabe-kanji-key 'nabe-translate-to-kanji) (global-set-key nabe-hiragana-key 'nabe-translate-to-hiragana) (defun nabe-translate-to-kanji (arg) (interactive "p") (let ((po (point)) (mark (or (mark t) 0))) (skip-chars-backward nabe-characters-to-translate) (if (and mark (< mark po) (< (point) mark)) (goto-char mark) ) (if (not (eq (point) po)) (funcall nabe-roman-to-kanji-function (point) po) ) (and auto-fill-function (funcall auto-fill-function)) )) (defun nabe-translate-to-hiragana (arg) (interactive "p") (let ((po (point)) (mark (or (mark t) 0))) (skip-chars-backward nabe-characters-to-translate) (if (and mark (< mark po) (< (point) mark)) (goto-char mark) ) (if (not (eq (point) po)) (save-restriction (narrow-to-region (point) po) (funcall nabe-roman-to-kana-function (point) po) (goto-char (point-max)) )) (and auto-fill-function (funcall auto-fill-function)) )) ;;; @ end ;;; (provide 'nabe) (run-hooks 'nabe-load-hook) ;;; nabe.el ends here