* riece-commands.el (riece-command-complete-user): New command.
authorueno <ueno>
Wed, 19 May 2004 07:00:26 +0000 (07:00 +0000)
committerueno <ueno>
Wed, 19 May 2004 07:00:26 +0000 (07:00 +0000)
* riece.el: Bind riece-command-complete-user.

lisp/ChangeLog
lisp/riece-commands.el
lisp/riece.el

index b15f30d..0741de6 100644 (file)
@@ -1,5 +1,10 @@
 2004-05-19  Daiki Ueno  <ueno@unixuser.org>
 
+       * riece-commands.el (riece-command-complete-user): New command.
+       * riece.el: Bind riece-command-complete-user.
+
+2004-05-19  Daiki Ueno  <ueno@unixuser.org>
+
        * riece-400.el (riece-handle-read-string): New function.
        (riece-handle-432-message): Use it.
        (riece-handle-433-message): Use it.
index 13d4c08..95bae12 100644 (file)
@@ -630,6 +630,27 @@ If prefix argument ARG is non-nil, toggle frozen status."
   (interactive "r")
   (kill-new (buffer-substring-no-properties start end)))
 
+(defun riece-command-complete-user ()
+  "Complete a user name in the current buffer."
+  (interactive)
+  (let* ((completion-ignore-case t)
+        (table (mapcar (lambda (user)
+                         (list (riece-format-identity user t)))
+                       (riece-get-users-on-server
+                        (riece-current-server-name))))
+        (current (current-word))
+        (completion (try-completion current table))
+        (all (all-completions current table)))
+    (if (eq completion t)
+       nil
+      (if (null completion)
+         (message "Can't find completion for \"%s\"" current)
+       (if (equal current completion)
+           (with-output-to-temp-buffer "*Help*"
+             (display-completion-list all))
+         (delete-region (point) (- (point) (length current)))
+         (insert completion))))))
+  
 (defun riece-command-open-server (server-name)
   (interactive
    (list (completing-read "Server: " riece-server-alist)))
index afd6780..1b66d48 100644 (file)
@@ -180,7 +180,8 @@ If optional argument SAFE is nil, overwrite previous definitions."
 
   (riece-define-keys riece-command-mode-map
     "\r" riece-command-enter-message
-    [(control return)] riece-command-enter-message-as-notice)
+    [(control return)] riece-command-enter-message-as-notice
+    [tab] riece-command-complete-user)
 
   (riece-define-keys (riece-command-map riece-command-prefix
                                        riece-command-mode-map)