Fix arglist of riece-command-set-operators and -speakers.
[riece] / lisp / riece-commands.el
index a6bdb9e..afaf950 100644 (file)
@@ -1,4 +1,4 @@
-;;; riece-commands.el --- commands available in command buffer
+;;; riece-commands.el --- commands available in command buffer -*- lexical-binding: t -*-
 ;; Copyright (C) 1998-2003 Daiki Ueno
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
@@ -34,8 +34,6 @@
 (require 'riece-message)
 (require 'riece-mcat)
 
-(autoload 'derived-mode-class "derived")
-
 ;;; Channel movement:
 (defun riece-command-switch-to-channel (channel)
   (interactive (list (riece-completing-read-identity
@@ -237,20 +235,18 @@ the layout to the selected layout-name."
 (defun riece-command-kick-with-ban (user pattern &optional message)
   (interactive
    (let ((completion-ignore-case t)
-        users)
+        user)
      (riece-check-channel-commands-are-usable t)
      (riece-with-server-buffer (riece-identity-server riece-current-channel)
-       (setq users (riece-channel-get-users (riece-identity-prefix
-                                            riece-current-channel))
+       (setq user (completing-read
+                  (riece-mcat "Kick user: ")
+                  (riece-channel-get-users (riece-identity-prefix
+                                            riece-current-channel))))
        (list
-       (completing-read (riece-mcat "Kick user: ") users)
-       (completing-read (riece-mcat "Ban pattern: ")
-                        (mapcar
-                         (lambda (user)
-                           (list (concat (car user) "!"
-                                         (riece-user-get-user-at-host
-                                          (car user)))))
-                         users))
+       user
+       (read-from-minibuffer
+        (riece-mcat "Ban pattern: ")
+        (concat user "!" (riece-user-get-user-at-host user)))
        (if current-prefix-arg
            (read-string "Message: "))))))
   (riece-send-string (format "MODE %s :+b %s\r\n"
@@ -312,6 +308,8 @@ the layout to the selected layout-name."
                        "Really want to query LIST without argument? ")))
       (riece-send-string (format "LIST %s\r\n" pattern))))
 
+(defvar riece-temp-minibuffer-message)
+(defvar riece-overriding-server-name)
 (defun riece-command-change-mode (channel change)
   (interactive
    (let* ((completion-ignore-case t)
@@ -345,7 +343,7 @@ the layout to the selected layout-name."
                               (riece-identity-prefix channel)
                               change))))
 
-(defun riece-command-set-operators (users &optional arg)
+(defun riece-command-set-operators (users &optional _arg)
   (interactive
    (progn
      (riece-check-channel-commands-are-usable t)
@@ -380,7 +378,7 @@ the layout to the selected layout-name."
                 (mapconcat #'identity (nreverse group) " ")))
        (setq group nil)))))
 
-(defun riece-command-set-speakers (users &optional arg)
+(defun riece-command-set-speakers (users &optional _arg)
   (interactive
    (progn
      (riece-check-channel-commands-are-usable t)
@@ -447,8 +445,10 @@ the layout to the selected layout-name."
                               (riece-line-beginning-position)
                               (riece-line-end-position))
                              nil)
-  (let ((next-line-add-newlines t))
-    (next-line 1)))
+  (forward-line 1)
+  (when (eobp)
+    (insert "\n")))
+
 
 (defun riece-command-enter-message-as-notice ()
   "Send the current line to the current channel as NOTICE."
@@ -457,8 +457,9 @@ the layout to the selected layout-name."
                               (riece-line-beginning-position)
                               (riece-line-end-position))
                              t)
-  (let ((next-line-add-newlines t))
-    (next-line 1)))
+  (forward-line 1)
+  (when (eobp)
+    (insert "\n")))
 
 (defun riece-command-enter-message-to-user (user)
   "Send the current line to USER."
@@ -478,8 +479,9 @@ the layout to the selected layout-name."
      user)
     (riece-display-message
      (riece-make-message (riece-current-nickname) user text nil t)))
-  (let ((next-line-add-newlines t))
-    (next-line 1)))
+  (forward-line 1)
+  (when (eobp)
+    (insert "\n")))
 
 (defun riece-command-join-channel (target key)
   (unless (riece-server-opened (riece-identity-server target))
@@ -631,8 +633,7 @@ the layout to the selected layout-name."
   "Prevent automatic scrolling of the dialogue window.
 If prefix argument ARG is non-nil, toggle frozen status."
   (interactive "P")
-  (with-current-buffer (if (eq (derived-mode-class major-mode)
-                              'riece-dialogue-mode)
+  (with-current-buffer (if (riece-derived-mode-p 'riece-dialogue-mode)
                           (current-buffer)
                         (if (and riece-channel-buffer-mode
                                  riece-channel-buffer)
@@ -649,8 +650,7 @@ If prefix argument ARG is non-nil, toggle frozen status."
 The difference from `riece-command-freeze' is that your messages are hidden.
 If prefix argument ARG is non-nil, toggle frozen status."
   (interactive "P")
-  (with-current-buffer (if (eq (derived-mode-class major-mode)
-                              'riece-dialogue-mode)
+  (with-current-buffer (if (riece-derived-mode-p 'riece-dialogue-mode)
                           (current-buffer)
                         (if (and riece-channel-buffer-mode
                                  riece-channel-buffer)