6e79db98fa7201403d0e576e5955c5674d642f49
[riece] / lisp / riece-skk-kakutei.el
1 ;;; riece-skk-kakutei.el --- remove SKK's preedit mark before sending messages
2 ;; Copyright (C) 2003 TAKAHASHI Kaoru
3
4 ;; Author: TAKAHASHI "beatmaria" Kaoru <kaoru@kaisei.org>
5 ;; Keywords: IRC, riece
6
7 ;; This file is part of Riece.
8
9 ;; This program is free software; you can redistribute it and/or
10 ;; modify it under the terms of the GNU General Public License as
11 ;; published by the Free Software Foundation; either version 2, or (at
12 ;; your option) any later version.
13
14 ;; This program is distributed in the hope that it will be useful, but
15 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 ;; General Public License for more details.
18
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 ;; Boston, MA 02111-1307, USA.
23
24 ;;; Commentary:
25
26 ;; NOTE: This is an add-on module for Riece.
27
28 ;;; Code:
29
30 (eval-when-compile (require 'riece))
31
32 (defvar riece-skk-kakutei-enabled nil)
33
34 (defconst riece-skk-kakutei-description
35   "Remove SKK's preedit mark before sending messages.")
36
37 (defun riece-skk-kakutei-command-enter-message ()
38   "Send the current line to the current channel."
39   (interactive)
40   (when (riece-skk-kakutei)
41     (riece-command-enter-message)))
42
43 (defun riece-skk-kakutei-command-enter-message-as-notice ()
44   "Send the current line to the current channel as NOTICE."
45   (interactive)
46   (when (riece-skk-kakutei)
47     (riece-command-enter-message-as-notice)))
48
49 (defun riece-skk-kakutei ()
50   "When required after-follow return `t'."
51   (interactive)
52   (cond ((or (not (boundp 'skk-mode)) (not skk-mode))
53          t)
54         ((and (boundp 'skk-henkan-mode) (not skk-henkan-mode))
55          t)
56         ((and (boundp 'skk-henkan-on) (not skk-henkan-on))
57          t)
58         (skk-egg-like-newline
59          (skk-kakutei)
60          nil)
61         (t
62          (skk-kakutei)
63          t)))
64
65 (defun riece-skk-kakutei-insinuate ()
66   )
67
68 (defun riece-skk-kakutei-enable ()
69   (riece-define-keys riece-command-mode-map
70     "\r" riece-skk-kakutei-command-enter-message
71     [(control return)] riece-skk-kakutei-command-enter-message-as-notice)
72   (setq riece-skk-kakutei-enabled t))
73
74 (defun riece-skk-kakutei-disable ()
75   (riece-define-keys riece-command-mode-map
76     "\r" riece-command-enter-message
77     [(control return)] riece-command-enter-message-as-notice)
78   (setq riece-skk-kakutei-enabled nil))
79
80 (provide 'riece-skk-kakutei)
81
82 ;;; riece-skk-kakutei.el ends here