Fixed typo.
[riece] / lisp / riece-foolproof.el
index f691a0a..bc606ea 100644 (file)
@@ -1,4 +1,4 @@
-;;; riece-foolproof.el --- channel miss killer
+;;; riece-foolproof.el --- prevent miss-operation in the command buffer
 ;; Copyright (C) 2004 TAKAHASHI Kaoru
 
 ;; Author: TAKAHASHI "beatmaria" Kaoru <kaoru@kaisei.org>
 
 ;;; Commentary:
 
-;; This add-on channel miss hold in check
-
-;; To use, add the following line to your ~/.riece/init.el:
-;; (add-to-list 'riece-addons 'riece-foolproof)
+;; NOTE: This is an add-on module for Riece.
 
 ;;; Code:
 
@@ -37,7 +34,7 @@
 (defvar riece-foolproof-enabled nil)
 
 (defconst riece-foolproof-description
-  "Channel miss killer")
+  "Prevent miss-operation in the command buffer.")
 
 (defun riece-foolproof-get-channel-window (identity)
   (get-buffer-window
                 riece-current-channel))
       (error "Channel %s is not displayed"
             (riece-identity-prefix riece-current-channel)))
+    (when (text-property-not-all
+          (riece-line-beginning-position) (riece-line-end-position)
+          'invisible nil)
+      (error "Invisible text included: %s"
+            (buffer-substring-no-properties
+             (riece-line-beginning-position)
+             (riece-line-end-position))))
     (when executing-kbd-macro
       (error "%s" "Forbidden to run keyboard macro"))))
 
   (add-hook 'riece-command-send-message-hook
            'riece-foolproof-command-send-message-function))
 
+(defun riece-foolproof-uninstall ()
+  (remove-hook 'riece-command-send-message-hook
+              'riece-foolproof-command-send-message-function))
+
 (defun riece-foolproof-enable ()
   (setq riece-foolproof-enabled t))