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.
(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)))
(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)