From 8778a2430233c66dcce6198a8703eb7228ef48e2 Mon Sep 17 00:00:00 2001 From: ueno Date: Wed, 19 May 2004 07:00:26 +0000 Subject: [PATCH] * riece-commands.el (riece-command-complete-user): New command. * riece.el: Bind riece-command-complete-user. --- lisp/ChangeLog | 5 +++++ lisp/riece-commands.el | 21 +++++++++++++++++++++ lisp/riece.el | 3 ++- 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b15f30d..0741de6 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,10 @@ 2004-05-19 Daiki Ueno + * riece-commands.el (riece-command-complete-user): New command. + * riece.el: Bind riece-command-complete-user. + +2004-05-19 Daiki Ueno + * riece-400.el (riece-handle-read-string): New function. (riece-handle-432-message): Use it. (riece-handle-433-message): Use it. diff --git a/lisp/riece-commands.el b/lisp/riece-commands.el index 13d4c08..95bae12 100644 --- a/lisp/riece-commands.el +++ b/lisp/riece-commands.el @@ -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))) diff --git a/lisp/riece.el b/lisp/riece.el index afd6780..1b66d48 100644 --- a/lisp/riece.el +++ b/lisp/riece.el @@ -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) -- 1.7.10.4