aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog16
-rw-r--r--lisp/net/rcirc.el81
2 files changed, 71 insertions, 26 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index dbc4b75d738..f39afc16d73 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,19 @@
12006-08-20 Ryan Yeske <rcyeske@gmail.com>
2
3 * net/rcirc.el (rcirc-show-maximum-output): New var.
4 (rcirc-buffer-process): If no buffer argument is supplied, use
5 current-buffer.
6 (rcirc-complete-nick): Complete to the last completed nick first.
7 (rcirc-mode): Preserve the value of `rcirc-urls' across
8 connections. Setup scroll function.
9 (rcirc-scroll-to-bottom): New function.
10 (rcirc-print): Use nick syntax around regexp work. Notice
11 dim-nicks speaking only if they say our nick.
12 (rcirc-update-activity-string): Do not show the modeline indicator
13 if there are no live rcirc processes.
14 (rcirc-cmd-ignore): Ignore case.
15 (rcirc-browse-url-at-point): Fix off-by-one error.
16
12006-08-20 Stefan Monnier <monnier@iro.umontreal.ca> 172006-08-20 Stefan Monnier <monnier@iro.umontreal.ca>
2 18
3 * progmodes/python.el: Remove * in defcustom docstrings. 19 * progmodes/python.el: Remove * in defcustom docstrings.
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
index 1f051ffa9f2..c34ac7dcf78 100644
--- a/lisp/net/rcirc.el
+++ b/lisp/net/rcirc.el
@@ -40,6 +40,8 @@
40;; Open a new irc connection with: 40;; Open a new irc connection with:
41;; M-x irc RET 41;; M-x irc RET
42 42
43;;; Todo:
44
43;;; Code: 45;;; Code:
44 46
45(require 'ring) 47(require 'ring)
@@ -140,6 +142,10 @@ number. If zero or nil, no truncating is done."
140 (integer :tag "Number of lines")) 142 (integer :tag "Number of lines"))
141 :group 'rcirc) 143 :group 'rcirc)
142 144
145(defcustom rcirc-show-maximum-output t
146 "*If non-nil, scroll buffer to keep the point at the bottom of
147the window.")
148
143(defcustom rcirc-authinfo nil 149(defcustom rcirc-authinfo nil
144 "List of authentication passwords. 150 "List of authentication passwords.
145Each element of the list is a list with a SERVER-REGEXP string 151Each element of the list is a list with a SERVER-REGEXP string
@@ -297,6 +303,7 @@ and the cdr part is used for encoding."
297 303
298(defvar rcirc-urls nil 304(defvar rcirc-urls nil
299 "List of urls seen in the current buffer.") 305 "List of urls seen in the current buffer.")
306(put 'rcirc-urls 'permanent-local t)
300 307
301(defvar rcirc-keepalive-seconds 60 308(defvar rcirc-keepalive-seconds 60
302 "Number of seconds between keepalive pings. 309 "Number of seconds between keepalive pings.
@@ -539,7 +546,10 @@ Function is called with PROCESS, COMMAND, SENDER, ARGS and LINE.")
539(defun rcirc-buffer-process (&optional buffer) 546(defun rcirc-buffer-process (&optional buffer)
540 "Return the process associated with channel BUFFER. 547 "Return the process associated with channel BUFFER.
541With no argument or nil as argument, use the current buffer." 548With no argument or nil as argument, use the current buffer."
542 (get-buffer-process (or buffer rcirc-server-buffer))) 549 (get-buffer-process (if buffer
550 (with-current-buffer buffer
551 rcirc-server-buffer)
552 rcirc-server-buffer)))
543 553
544(defun rcirc-server-name (process) 554(defun rcirc-server-name (process)
545 "Return PROCESS server name, given by the 001 response." 555 "Return PROCESS server name, given by the 001 response."
@@ -601,10 +611,11 @@ If NOTICEP is non-nil, send a notice instead of privmsg."
601 611
602(defvar rcirc-nick-completions nil) 612(defvar rcirc-nick-completions nil)
603(defvar rcirc-nick-completion-start-offset nil) 613(defvar rcirc-nick-completion-start-offset nil)
614
604(defun rcirc-complete-nick () 615(defun rcirc-complete-nick ()
605 "Cycle through nick completions from list of nicks in channel." 616 "Cycle through nick completions from list of nicks in channel."
606 (interactive) 617 (interactive)
607 (if (eq last-command 'rcirc-complete-nick) 618 (if (eq last-command this-command)
608 (setq rcirc-nick-completions 619 (setq rcirc-nick-completions
609 (append (cdr rcirc-nick-completions) 620 (append (cdr rcirc-nick-completions)
610 (list (car rcirc-nick-completions)))) 621 (list (car rcirc-nick-completions))))
@@ -626,9 +637,10 @@ If NOTICEP is non-nil, send a notice instead of privmsg."
626 rcirc-target)))))) 637 rcirc-target))))))
627 (let ((completion (car rcirc-nick-completions))) 638 (let ((completion (car rcirc-nick-completions)))
628 (when completion 639 (when completion
640 (rcirc-put-nick-channel (rcirc-buffer-process) completion rcirc-target)
629 (delete-region (+ rcirc-prompt-end-marker 641 (delete-region (+ rcirc-prompt-end-marker
630 rcirc-nick-completion-start-offset) 642 rcirc-nick-completion-start-offset)
631 (point)) 643 (point))
632 (insert (concat completion 644 (insert (concat completion
633 (if (= (+ rcirc-prompt-end-marker 645 (if (= (+ rcirc-prompt-end-marker
634 rcirc-nick-completion-start-offset) 646 rcirc-nick-completion-start-offset)
@@ -709,7 +721,6 @@ If NOTICEP is non-nil, send a notice instead of privmsg."
709 (make-local-variable 'rcirc-short-buffer-name) 721 (make-local-variable 'rcirc-short-buffer-name)
710 (setq rcirc-short-buffer-name nil) 722 (setq rcirc-short-buffer-name nil)
711 (make-local-variable 'rcirc-urls) 723 (make-local-variable 'rcirc-urls)
712 (setq rcirc-urls nil)
713 (setq use-hard-newlines t) 724 (setq use-hard-newlines t)
714 725
715 (make-local-variable 'rcirc-decode-coding-system) 726 (make-local-variable 'rcirc-decode-coding-system)
@@ -742,6 +753,9 @@ If NOTICEP is non-nil, send a notice instead of privmsg."
742 (make-local-variable 'kill-buffer-hook) 753 (make-local-variable 'kill-buffer-hook)
743 (add-hook 'kill-buffer-hook 'rcirc-kill-buffer-hook) 754 (add-hook 'kill-buffer-hook 'rcirc-kill-buffer-hook)
744 755
756 (make-local-variable 'window-scroll-functions)
757 (add-hook 'window-scroll-functions 'rcirc-scroll-to-bottom)
758
745 ;; add to buffer list, and update buffer abbrevs 759 ;; add to buffer list, and update buffer abbrevs
746 (when target ; skip server buffer 760 (when target ; skip server buffer
747 (let ((buffer (current-buffer))) 761 (let ((buffer (current-buffer)))
@@ -1144,6 +1158,15 @@ is found by looking up RESPONSE in `rcirc-response-formats'."
1144(make-variable-buffer-local 'rcirc-last-sender) 1158(make-variable-buffer-local 'rcirc-last-sender)
1145(defvar rcirc-gray-toggle nil) 1159(defvar rcirc-gray-toggle nil)
1146(make-variable-buffer-local 'rcirc-gray-toggle) 1160(make-variable-buffer-local 'rcirc-gray-toggle)
1161
1162(defun rcirc-scroll-to-bottom (window display-start)
1163 "Scroll window to show maximum output if `rcirc-show-maximum-output' is
1164non-nil."
1165 (when rcirc-show-maximum-output
1166 (with-selected-window window
1167 (when (>= (window-point) rcirc-prompt-end-marker)
1168 (recenter -1)))))
1169
1147(defun rcirc-print (process sender response target text &optional activity) 1170(defun rcirc-print (process sender response target text &optional activity)
1148 "Print TEXT in the buffer associated with TARGET. 1171 "Print TEXT in the buffer associated with TARGET.
1149Format based on SENDER and RESPONSE. If ACTIVITY is non-nil, 1172Format based on SENDER and RESPONSE. If ACTIVITY is non-nil,
@@ -1240,16 +1263,19 @@ record activity."
1240 ;; record modeline activity 1263 ;; record modeline activity
1241 (when activity 1264 (when activity
1242 (let ((nick-match 1265 (let ((nick-match
1243 (string-match (concat "\\b" 1266 (with-syntax-table rcirc-nick-syntax-table
1244 (regexp-quote (rcirc-nick process)) 1267 (string-match (concat "\\b"
1245 "\\b") 1268 (regexp-quote (rcirc-nick process))
1246 text))) 1269 "\\b")
1270 text))))
1247 (when (if rcirc-ignore-buffer-activity-flag 1271 (when (if rcirc-ignore-buffer-activity-flag
1248 ;; - Always notice when our nick is mentioned 1272 ;; - Always notice when our nick is mentioned
1249 nick-match 1273 nick-match
1250 ;; - Never bother us if a dim-nick spoke 1274 ;; - unless our nick is mentioned, don't bother us
1251 (not (and rcirc-dim-nick-regexp sender 1275 ;; - with dim-nicks
1252 (string-match rcirc-dim-nick-regexp sender)))) 1276 (or nick-match
1277 (not (and rcirc-dim-nick-regexp sender
1278 (string-match rcirc-dim-nick-regexp sender)))))
1253 (rcirc-record-activity 1279 (rcirc-record-activity
1254 (current-buffer) 1280 (current-buffer)
1255 (when (or nick-match (and (not (rcirc-channel-p rcirc-target)) 1281 (when (or nick-match (and (not (rcirc-channel-p rcirc-target))
@@ -1504,18 +1530,20 @@ activity. Only run if the buffer is not visible and
1504 (lopri (car pair)) 1530 (lopri (car pair))
1505 (hipri (cdr pair))) 1531 (hipri (cdr pair)))
1506 (setq rcirc-activity-string 1532 (setq rcirc-activity-string
1507 (if (or hipri lopri) 1533 (cond ((or hipri lopri)
1508 (concat "-" 1534 (concat "-"
1509 (and hipri "[") 1535 (and hipri "[")
1510 (rcirc-activity-string hipri) 1536 (rcirc-activity-string hipri)
1511 (and hipri lopri ",") 1537 (and hipri lopri ",")
1512 (and lopri 1538 (and lopri
1513 (concat "(" 1539 (concat "("
1514 (rcirc-activity-string lopri) 1540 (rcirc-activity-string lopri)
1515 ")")) 1541 ")"))
1516 (and hipri "]") 1542 (and hipri "]")
1517 "-") 1543 "-"))
1518 "-[]-")))) 1544 ((not (null (rcirc-process-list)))
1545 "-[]-")
1546 (t "")))))
1519 1547
1520(defun rcirc-activity-string (buffers) 1548(defun rcirc-activity-string (buffers)
1521 (mapconcat (lambda (b) 1549 (mapconcat (lambda (b)
@@ -1771,7 +1799,7 @@ nicks when no NICK is given. When listing ignored nicks, the
1771ones added to the list automatically are marked with an asterisk." 1799ones added to the list automatically are marked with an asterisk."
1772 (interactive "sToggle ignoring of nick: ") 1800 (interactive "sToggle ignoring of nick: ")
1773 (when (not (string= "" nick)) 1801 (when (not (string= "" nick))
1774 (if (member nick rcirc-ignore-list) 1802 (if (member-ignore-case nick rcirc-ignore-list)
1775 (setq rcirc-ignore-list (delete nick rcirc-ignore-list)) 1803 (setq rcirc-ignore-list (delete nick rcirc-ignore-list))
1776 (setq rcirc-ignore-list (cons nick rcirc-ignore-list)))) 1804 (setq rcirc-ignore-list (cons nick rcirc-ignore-list))))
1777 (rcirc-print process (rcirc-nick process) "IGNORE" target 1805 (rcirc-print process (rcirc-nick process) "IGNORE" target
@@ -1800,6 +1828,7 @@ ones added to the list automatically are marked with an asterisk."
1800 "://") 1828 "://")
1801 "www.") 1829 "www.")
1802 (1+ (char "-a-zA-Z0-9_.")) 1830 (1+ (char "-a-zA-Z0-9_."))
1831 (1+ (char "-a-zA-Z0-9_"))
1803 (optional ":" (1+ (char "0-9")))) 1832 (optional ":" (1+ (char "0-9"))))
1804 (and (1+ (char "-a-zA-Z0-9_.")) 1833 (and (1+ (char "-a-zA-Z0-9_."))
1805 (or ".com" ".net" ".org") 1834 (or ".com" ".net" ".org")
@@ -1823,7 +1852,7 @@ ones added to the list automatically are marked with an asterisk."
1823(defun rcirc-browse-url-at-point (point) 1852(defun rcirc-browse-url-at-point (point)
1824 "Send URL at point to `browse-url'." 1853 "Send URL at point to `browse-url'."
1825 (interactive "d") 1854 (interactive "d")
1826 (let ((beg (previous-single-property-change point 'mouse-face)) 1855 (let ((beg (previous-single-property-change (1+ point) 'mouse-face))
1827 (end (next-single-property-change point 'mouse-face))) 1856 (end (next-single-property-change point 'mouse-face)))
1828 (browse-url (buffer-substring-no-properties beg end)))) 1857 (browse-url (buffer-substring-no-properties beg end))))
1829 1858