* riece-foolproof.el (riece-foolproof-dmacro-override): New
authorTAKAHASHI Kaoru <kaoru@kaisei.org>
Fri, 11 Jun 2004 02:31:13 +0000 (02:31 +0000)
committerTAKAHASHI Kaoru <kaoru@kaisei.org>
Fri, 11 Jun 2004 02:31:13 +0000 (02:31 +0000)
function.
(riece-foolproof-insinuate): Check keyboard macro.

lisp/ChangeLog
lisp/riece-foolproof.el

index 72fded6..5f54030 100644 (file)
@@ -1,3 +1,9 @@
+2004-06-11  TAKAHASHI Kaoru  <kaoru@kaisei.org>
+
+       * riece-foolproof.el (riece-foolproof-dmacro-override): New
+       function.
+       (riece-foolproof-insinuate): Check keyboard macro.
+
 2004-06-10  TAKAHASHI Kaoru  <kaoru@kaisei.org>
 
        * riece-foolproof.el: New add-on.
 2004-06-10  TAKAHASHI Kaoru  <kaoru@kaisei.org>
 
        * riece-foolproof.el: New add-on.
index 226d654..5e06b34 100644 (file)
 
 ;;; Code:
 
 
 ;;; Code:
 
-(eval-when-compile (require 'riece))
+(eval-when-compile
+  (require 'riece-identity)
+  (require 'riece-display))
 
 (defvar riece-foolproof-enabled nil)
 
 (defconst riece-foolproof-description
 
 (defvar riece-foolproof-enabled nil)
 
 (defconst riece-foolproof-description
-  "Disable channel miss")
-
-(defun riece-foolproof-command-enter-message ()
-  "Send the current line to the current channel."
-  (interactive)
-  (when (riece-foolproof)
-    (riece-command-enter-message)))
-
-(defun riece-foolproof-command-enter-message-as-notice ()
-  "Send the current line to the current channel as NOTICE."
-  (interactive)
-  (when (riece-foolproof)
-    (riece-command-enter-message-as-notice)))
+  "Channel miss killer")
 
 (defun riece-foolproof-get-channel-window (identity)
   (get-buffer-window
    (cdr (riece-identity-assoc
         identity riece-channel-buffer-alist))))
 
 
 (defun riece-foolproof-get-channel-window (identity)
   (get-buffer-window
    (cdr (riece-identity-assoc
         identity riece-channel-buffer-alist))))
 
+(eval-when-compile
+  (defvar *dmacro-key* nil))
+
+(defun riece-foolproof-dmacro-override (&optional arg)
+  (when (and (fboundp 'dmacro-exec) (boundp '*dmacro-key*))
+    (with-current-buffer riece-command-buffer
+      (if arg
+         (when (eq (key-binding *dmacro-key*) 'dmacro-exec)
+           (local-set-key *dmacro-key* #'ignore))
+       (when (eq (key-binding *dmacro-key*) 'ignore)
+         (local-unset-key *dmacro-key*))))))
+
 (defun riece-foolproof-insinuate ()
   (defadvice riece-command-send-message (before riece-foolproof)
     (unless (or (not riece-channel-buffer-mode)
                (riece-foolproof-get-channel-window
                 riece-current-channel))
       (error "%s is not displayed. (maybe channel miss)"
 (defun riece-foolproof-insinuate ()
   (defadvice riece-command-send-message (before riece-foolproof)
     (unless (or (not riece-channel-buffer-mode)
                (riece-foolproof-get-channel-window
                 riece-current-channel))
       (error "%s is not displayed. (maybe channel miss)"
-            (riece-identity-prefix riece-current-channel)))))
+            (riece-identity-prefix riece-current-channel)))
+    (unless (null executing-macro)
+      (error "Don't use `riece-command-send-message' in keyboard macro"))))
 
 (defun riece-foolproof-enable ()
 
 (defun riece-foolproof-enable ()
+  (riece-foolproof-dmacro-override t)
   (ad-enable-advice 'riece-command-send-message 'before 'riece-foolproof)
   (ad-activate 'riece-command-send-message)
   (setq riece-foolproof-enabled t))
 
 (defun riece-foolproof-disable ()
   (ad-enable-advice 'riece-command-send-message 'before 'riece-foolproof)
   (ad-activate 'riece-command-send-message)
   (setq riece-foolproof-enabled t))
 
 (defun riece-foolproof-disable ()
+  (riece-foolproof-dmacro-override nil)
   (ad-disable-advice 'riece-command-send-message 'before 'riece-foolproof)
   (ad-activate 'riece-command-send-message)
   (setq riece-foolproof-enabled nil))
   (ad-disable-advice 'riece-command-send-message 'before 'riece-foolproof)
   (ad-activate 'riece-command-send-message)
   (setq riece-foolproof-enabled nil))