From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ryan Yeske Newsgroups: gmane.emacs.devel Subject: rcirc update Date: Sun, 20 Aug 2006 10:50:36 -0700 Message-ID: <87zmdzmh3n.fsf@cut.bc.hsia.telus.net> NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1156101530 32032 80.91.229.2 (20 Aug 2006 19:18:50 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 20 Aug 2006 19:18:50 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Aug 20 21:18:48 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GEsof-00089j-KL for ged-emacs-devel@m.gmane.org; Sun, 20 Aug 2006 21:18:38 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GEsoe-0006A4-S6 for ged-emacs-devel@m.gmane.org; Sun, 20 Aug 2006 15:18:36 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GErTf-0000N7-Nz for emacs-devel@gnu.org; Sun, 20 Aug 2006 13:52:51 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GErTT-0000GB-1W for emacs-devel@gnu.org; Sun, 20 Aug 2006 13:52:51 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GErTS-0000G2-Lx for emacs-devel@gnu.org; Sun, 20 Aug 2006 13:52:38 -0400 Original-Received: from [204.209.205.55] (helo=defout.telus.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GErac-0002wy-1H for emacs-devel@gnu.org; Sun, 20 Aug 2006 14:00:04 -0400 Original-Received: from priv-edmwaa06.telusplanet.net ([207.6.239.189]) by priv-edmwes50.telusplanet.net (InterMail vM.7.05.01.01 201-2174-106-103-20060222) with ESMTP id <20060820175037.JXBI10727.priv-edmwes50.telusplanet.net@priv-edmwaa06.telusplanet.net> for ; Sun, 20 Aug 2006 11:50:37 -0600 Original-Received: from cut.bc.hsia.telus.net (d207-6-239-189.bchsia.telus.net [207.6.239.189]) by priv-edmwaa06.telusplanet.net (BorderWare MXtreme Infinity Mail Firewall) with ESMTP id BED7R12XKE for ; Sun, 20 Aug 2006 11:50:37 -0600 (MDT) Original-To: emacs-devel@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:58560 Archived-At: 2006-08-20 Ryan Yeske * net/rcirc.el (rcirc-show-maximum-output): New var. (rcirc-buffer-process): If no buffer argument is supplied, use current-buffer. (rcirc-complete-nick): Complete to the last completed nick first. (rcirc-mode): Preserve the value of `rcirc-urls' across connections. Setup scroll function. (rcirc-scroll-to-bottom): New function. (rcirc-print): Use nick syntax around regexp work. Notice dim-nicks speaking only if they say our nick. (rcirc-update-activity-string): Do not show the modeline indicator if there are no live rcirc processes. (rcirc-cmd-ignore): Ignore case. (rcirc-browse-url-at-point): Fix off-by-one error. Index: rcirc.el =================================================================== RCS file: /sources/emacs/emacs/lisp/net/rcirc.el,v retrieving revision 1.24 diff -c -r1.24 rcirc.el *** rcirc.el 23 Jun 2006 13:33:08 -0000 1.24 --- rcirc.el 20 Aug 2006 17:41:14 -0000 *************** *** 40,45 **** --- 40,47 ---- ;; Open a new irc connection with: ;; M-x irc RET + ;;; Todo: + ;;; Code: (require 'ring) *************** *** 140,145 **** --- 142,151 ---- (integer :tag "Number of lines")) :group 'rcirc) + (defcustom rcirc-show-maximum-output t + "*If non-nil, scroll buffer to keep the point at the bottom of + the window.") + (defcustom rcirc-authinfo nil "List of authentication passwords. Each element of the list is a list with a SERVER-REGEXP string *************** *** 297,302 **** --- 303,309 ---- (defvar rcirc-urls nil "List of urls seen in the current buffer.") + (put 'rcirc-urls 'permanent-local t) (defvar rcirc-keepalive-seconds 60 "Number of seconds between keepalive pings. *************** *** 539,545 **** (defun rcirc-buffer-process (&optional buffer) "Return the process associated with channel BUFFER. With no argument or nil as argument, use the current buffer." ! (get-buffer-process (or buffer rcirc-server-buffer))) (defun rcirc-server-name (process) "Return PROCESS server name, given by the 001 response." --- 546,555 ---- (defun rcirc-buffer-process (&optional buffer) "Return the process associated with channel BUFFER. With no argument or nil as argument, use the current buffer." ! (get-buffer-process (if buffer ! (with-current-buffer buffer ! rcirc-server-buffer) ! rcirc-server-buffer))) (defun rcirc-server-name (process) "Return PROCESS server name, given by the 001 response." *************** *** 601,610 **** (defvar rcirc-nick-completions nil) (defvar rcirc-nick-completion-start-offset nil) (defun rcirc-complete-nick () "Cycle through nick completions from list of nicks in channel." (interactive) ! (if (eq last-command 'rcirc-complete-nick) (setq rcirc-nick-completions (append (cdr rcirc-nick-completions) (list (car rcirc-nick-completions)))) --- 611,621 ---- (defvar rcirc-nick-completions nil) (defvar rcirc-nick-completion-start-offset nil) + (defun rcirc-complete-nick () "Cycle through nick completions from list of nicks in channel." (interactive) ! (if (eq last-command this-command) (setq rcirc-nick-completions (append (cdr rcirc-nick-completions) (list (car rcirc-nick-completions)))) *************** *** 626,634 **** rcirc-target)))))) (let ((completion (car rcirc-nick-completions))) (when completion (delete-region (+ rcirc-prompt-end-marker ! rcirc-nick-completion-start-offset) ! (point)) (insert (concat completion (if (= (+ rcirc-prompt-end-marker rcirc-nick-completion-start-offset) --- 637,646 ---- rcirc-target)))))) (let ((completion (car rcirc-nick-completions))) (when completion + (rcirc-put-nick-channel (rcirc-buffer-process) completion rcirc-target) (delete-region (+ rcirc-prompt-end-marker ! rcirc-nick-completion-start-offset) ! (point)) (insert (concat completion (if (= (+ rcirc-prompt-end-marker rcirc-nick-completion-start-offset) *************** *** 709,715 **** (make-local-variable 'rcirc-short-buffer-name) (setq rcirc-short-buffer-name nil) (make-local-variable 'rcirc-urls) - (setq rcirc-urls nil) (setq use-hard-newlines t) (make-local-variable 'rcirc-decode-coding-system) --- 721,726 ---- *************** *** 742,747 **** --- 753,761 ---- (make-local-variable 'kill-buffer-hook) (add-hook 'kill-buffer-hook 'rcirc-kill-buffer-hook) + (make-local-variable 'window-scroll-functions) + (add-hook 'window-scroll-functions 'rcirc-scroll-to-bottom) + ;; add to buffer list, and update buffer abbrevs (when target ; skip server buffer (let ((buffer (current-buffer))) *************** *** 1144,1149 **** --- 1158,1172 ---- (make-variable-buffer-local 'rcirc-last-sender) (defvar rcirc-gray-toggle nil) (make-variable-buffer-local 'rcirc-gray-toggle) + + (defun rcirc-scroll-to-bottom (window display-start) + "Scroll window to show maximum output if `rcirc-show-maximum-output' is + non-nil." + (when rcirc-show-maximum-output + (with-selected-window window + (when (>= (window-point) rcirc-prompt-end-marker) + (recenter -1))))) + (defun rcirc-print (process sender response target text &optional activity) "Print TEXT in the buffer associated with TARGET. Format based on SENDER and RESPONSE. If ACTIVITY is non-nil, *************** *** 1240,1255 **** ;; record modeline activity (when activity (let ((nick-match ! (string-match (concat "\\b" ! (regexp-quote (rcirc-nick process)) ! "\\b") ! text))) (when (if rcirc-ignore-buffer-activity-flag ;; - Always notice when our nick is mentioned nick-match ! ;; - Never bother us if a dim-nick spoke ! (not (and rcirc-dim-nick-regexp sender ! (string-match rcirc-dim-nick-regexp sender)))) (rcirc-record-activity (current-buffer) (when (or nick-match (and (not (rcirc-channel-p rcirc-target)) --- 1263,1281 ---- ;; record modeline activity (when activity (let ((nick-match ! (with-syntax-table rcirc-nick-syntax-table ! (string-match (concat "\\b" ! (regexp-quote (rcirc-nick process)) ! "\\b") ! text)))) (when (if rcirc-ignore-buffer-activity-flag ;; - Always notice when our nick is mentioned nick-match ! ;; - unless our nick is mentioned, don't bother us ! ;; - with dim-nicks ! (or nick-match ! (not (and rcirc-dim-nick-regexp sender ! (string-match rcirc-dim-nick-regexp sender))))) (rcirc-record-activity (current-buffer) (when (or nick-match (and (not (rcirc-channel-p rcirc-target)) *************** *** 1504,1521 **** (lopri (car pair)) (hipri (cdr pair))) (setq rcirc-activity-string ! (if (or hipri lopri) ! (concat "-" ! (and hipri "[") ! (rcirc-activity-string hipri) ! (and hipri lopri ",") ! (and lopri ! (concat "(" ! (rcirc-activity-string lopri) ! ")")) ! (and hipri "]") ! "-") ! "-[]-")))) (defun rcirc-activity-string (buffers) (mapconcat (lambda (b) --- 1530,1549 ---- (lopri (car pair)) (hipri (cdr pair))) (setq rcirc-activity-string ! (cond ((or hipri lopri) ! (concat "-" ! (and hipri "[") ! (rcirc-activity-string hipri) ! (and hipri lopri ",") ! (and lopri ! (concat "(" ! (rcirc-activity-string lopri) ! ")")) ! (and hipri "]") ! "-")) ! ((not (null (rcirc-process-list))) ! "-[]-") ! (t ""))))) (defun rcirc-activity-string (buffers) (mapconcat (lambda (b) *************** *** 1771,1777 **** ones added to the list automatically are marked with an asterisk." (interactive "sToggle ignoring of nick: ") (when (not (string= "" nick)) ! (if (member nick rcirc-ignore-list) (setq rcirc-ignore-list (delete nick rcirc-ignore-list)) (setq rcirc-ignore-list (cons nick rcirc-ignore-list)))) (rcirc-print process (rcirc-nick process) "IGNORE" target --- 1799,1805 ---- ones added to the list automatically are marked with an asterisk." (interactive "sToggle ignoring of nick: ") (when (not (string= "" nick)) ! (if (member-ignore-case nick rcirc-ignore-list) (setq rcirc-ignore-list (delete nick rcirc-ignore-list)) (setq rcirc-ignore-list (cons nick rcirc-ignore-list)))) (rcirc-print process (rcirc-nick process) "IGNORE" target *************** *** 1800,1805 **** --- 1828,1834 ---- "://") "www.") (1+ (char "-a-zA-Z0-9_.")) + (1+ (char "-a-zA-Z0-9_")) (optional ":" (1+ (char "0-9")))) (and (1+ (char "-a-zA-Z0-9_.")) (or ".com" ".net" ".org") *************** *** 1823,1829 **** (defun rcirc-browse-url-at-point (point) "Send URL at point to `browse-url'." (interactive "d") ! (let ((beg (previous-single-property-change point 'mouse-face)) (end (next-single-property-change point 'mouse-face))) (browse-url (buffer-substring-no-properties beg end)))) --- 1852,1858 ---- (defun rcirc-browse-url-at-point (point) "Send URL at point to `browse-url'." (interactive "d") ! (let ((beg (previous-single-property-change (1+ point) 'mouse-face)) (end (next-single-property-change point 'mouse-face))) (browse-url (buffer-substring-no-properties beg end))))