X-Git-Url: https://cgit.sxemacs.org/?a=blobdiff_plain;f=lisp%2Friece-commands.el;h=3a80f991b8253184621dc9c099c74429fd0ebdb4;hb=0058bab7a52f813282167910b2a884715aeec0ef;hp=3436926d05ac6f344fe24059f47054574f83bb19;hpb=5eab9d5c3a49f50a3931064b802f41c62677617d;p=riece diff --git a/lisp/riece-commands.el b/lisp/riece-commands.el index 3436926..3a80f99 100644 --- a/lisp/riece-commands.el +++ b/lisp/riece-commands.el @@ -278,7 +278,7 @@ the layout to the selected layout-name." (if (equal change "") (riece-send-string (format "MODE %s\r\n" (riece-identity-prefix channel))) - (riece-send-string (format "MODE %s :%s\r\n" + (riece-send-string (format "MODE %s %s\r\n" (riece-identity-prefix channel) change)))) @@ -354,6 +354,7 @@ the layout to the selected layout-name." (defun riece-command-send-message (message notice) "Send MESSAGE to the current channel." + (run-hooks 'riece-command-send-message-hook) (if (equal message "") (error "No text to send")) (riece-check-channel-commands-are-usable) @@ -397,11 +398,13 @@ the layout to the selected layout-name." (defun riece-command-enter-message-to-user (user) "Send the current line to USER." (interactive - (let ((completion-ignore-case t)) - (list (riece-completing-read-identity - "Message to user: " - (riece-get-users-on-server (riece-current-server-name)) - nil nil nil nil nil t)))) + (if (and (bolp) (eolp)) + (error "No text to send") + (let ((completion-ignore-case t)) + (list (riece-completing-read-identity + "Message to user: " + (riece-get-users-on-server (riece-current-server-name)) + nil nil nil nil nil t))))) (let ((text (buffer-substring (riece-line-beginning-position) (riece-line-end-position)))) @@ -624,8 +627,23 @@ If prefix argument ARG is non-nil, toggle frozen status." (interactive "sIRC command: ") (riece-send-string (concat command "\r\n"))) +(defun riece-command-beginning-of-buffer () + "Scroll channel buffer to the beginning." + (interactive) + (let (buffer window) + (setq buffer (if riece-channel-buffer-mode + riece-channel-buffer + riece-dialogue-buffer)) + (or (setq window (get-buffer-window buffer)) + (setq window (get-buffer-window riece-dialogue-buffer) + buffer riece-dialogue-buffer)) + (when window + (save-selected-window + (select-window window) + (goto-char (point-min)))))) + (defun riece-command-end-of-buffer () - "Get end of the dialogue buffer." + "Scroll channel buffer to the end." (interactive) (let (buffer window) (setq buffer (if riece-channel-buffer-mode @@ -652,7 +670,7 @@ If prefix argument ARG is non-nil, toggle frozen status." (list (riece-format-identity user t))) (riece-get-users-on-server (riece-current-server-name)))) - (current (current-word)) + (current (or (current-word) "")) (completion (try-completion current table)) (all (all-completions current table))) (if (eq completion t) @@ -662,6 +680,7 @@ If prefix argument ARG is non-nil, toggle frozen status." (if (equal current completion) (with-output-to-temp-buffer "*Help*" (display-completion-list all)) + (re-search-forward "\\>" nil t) (delete-region (point) (- (point) (length current))) (insert completion))))))