;;; rcirc.el --- default, simple IRC client.
-;; Copyright (C) 2005-2011 Free Software Foundation, Inc.
+;; Copyright (C) 2005-2012 Free Software Foundation, Inc.
;; Author: Ryan Yeske <rcyeske@gmail.com>
;; Maintainers: Ryan Yeske <rcyeske@gmail.com>,
(defun rcirc-disconnect-buffer (&optional buffer)
(with-current-buffer (or buffer (current-buffer))
;; set rcirc-target to nil for each channel so cleanup
- ;; doesnt happen when we reconnect
+ ;; doesn't happen when we reconnect
(setq rcirc-target nil)
(setq mode-line-process ":disconnected")))
(defvar rcirc-input-ring nil)
(defvar rcirc-input-ring-index 0)
+
(defun rcirc-prev-input-string (arg)
(ring-ref rcirc-input-ring (+ rcirc-input-ring-index arg)))
-(defun rcirc-insert-prev-input (arg)
- (interactive "p")
+(defun rcirc-insert-prev-input ()
+ (interactive)
(when (<= rcirc-prompt-end-marker (point))
(delete-region rcirc-prompt-end-marker (point-max))
(insert (rcirc-prev-input-string 0))
(setq rcirc-input-ring-index (1+ rcirc-input-ring-index))))
-(defun rcirc-insert-next-input (arg)
- (interactive "p")
+(defun rcirc-insert-next-input ()
+ (interactive)
(when (<= rcirc-prompt-end-marker (point))
(delete-region rcirc-prompt-end-marker (point-max))
(setq rcirc-input-ring-index (1- rcirc-input-ring-index))
(setq mode-line-process nil)
(set (make-local-variable 'rcirc-input-ring)
- (make-ring rcirc-input-ring-size))
+ ;; If rcirc-input-ring is already a ring with desired size do
+ ;; not re-initialize.
+ (if (and (ring-p rcirc-input-ring)
+ (= (ring-size rcirc-input-ring)
+ rcirc-input-ring-size))
+ rcirc-input-ring
+ (make-ring rcirc-input-ring-size)))
(set (make-local-variable 'rcirc-server-buffer) (process-buffer process))
(set (make-local-variable 'rcirc-target) target)
(set (make-local-variable 'rcirc-topic) nil)
(set (make-local-variable 'rcirc-recent-quit-alist) nil)
(set (make-local-variable 'rcirc-current-line) 0)
+ (use-hard-newlines t)
(set (make-local-variable 'rcirc-short-buffer-name) nil)
(set (make-local-variable 'rcirc-urls) nil)
;; keep window on bottom line if it was already there
(when rcirc-scroll-show-maximum-output
- (walk-windows (lambda (w)
- (when (eq (window-buffer w) (current-buffer))
- (with-current-buffer (window-buffer w)
- (when (eq major-mode 'rcirc-mode)
- (with-selected-window w
- (when (<= (- (window-height)
- (count-screen-lines (window-point)
- (window-start))
- 1)
- 0)
- (recenter -1)))))))
- nil t))
+ (let ((window (get-buffer-window)))
+ (when window
+ (with-selected-window window
+ (when (eq major-mode 'rcirc-mode)
+ (when (<= (- (window-height)
+ (count-screen-lines (window-point)
+ (window-start))
+ 1)
+ 0)
+ (recenter -1)))))))
;; flush undo (can we do something smarter here?)
(buffer-disable-undo)
(dolist (b buffers) ;; order the new channel buffers in the buffer list
(switch-to-buffer b)))))
+(defun-rcirc-command invite (nick-channel)
+ "Invite NICK to CHANNEL."
+ (interactive (list
+ (concat
+ (completing-read "Invite nick: "
+ (with-rcirc-server-buffer rcirc-nick-table))
+ " "
+ (read-string "Channel: "))))
+ (rcirc-send-string process (concat "INVITE " nick-channel)))
+
;; TODO: /part #channel reason, or consider removing #channel altogether
(defun-rcirc-command part (channel)
"Part CHANNEL."
(member message
(list
(format "You are now identified for \C-b%s\C-b." rcirc-nick)
+ (format "You are successfully identified as \C-b%s\C-b." rcirc-nick)
"Password accepted - you are now recognized."
)))
(and ;; quakenet