comparison lisp/net/rcirc.el @ 68563:979fba30166f

(rcirc-debug): Fix docstring. (rcirc-fill-column, rcirc-receive-message-hooks, rcirc-browse-url-map, rcirc-read-only-flag, rcirc-prompt, rcirc-mode, rcirc-generate-new-buffer-name, rcirc-startup-channels, rcirc-ignore-update-automatic, rcirc-cmd-ignore, rcirc-browse-url, rcirc-url-regexp): Fix typos in docstrings. (rcirc-print): "?\ " -> "?\s".
author Juanma Barranquero <lekktu@gmail.com>
date Thu, 02 Feb 2006 11:47:17 +0000
parents 61e9ea461d3c
children 2b5f6787aa4f 49f9dd4bb117
comparison
equal deleted inserted replaced
68562:26cf94e56f83 68563:979fba30166f
90 :type 'boolean 90 :type 'boolean
91 :group 'rcirc) 91 :group 'rcirc)
92 92
93 (defcustom rcirc-fill-column nil 93 (defcustom rcirc-fill-column nil
94 "*Column beyond which automatic line-wrapping should happen. 94 "*Column beyond which automatic line-wrapping should happen.
95 If nil, use value of `fill-column'. If frame-width, use the 95 If nil, use value of `fill-column'. If 'frame-width, use the
96 maximum frame width." 96 maximum frame width."
97 :type '(choice (const :tag "Value of `fill-column'") 97 :type '(choice (const :tag "Value of `fill-column'")
98 (const :tag "Full frame width" frame-width) 98 (const :tag "Full frame width" frame-width)
99 (integer :tag "Number of columns")) 99 (integer :tag "Number of columns"))
100 :group 'rcirc) 100 :group 'rcirc)
126 "*Size of input history ring." 126 "*Size of input history ring."
127 :type 'integer 127 :type 'integer
128 :group 'rcirc) 128 :group 'rcirc)
129 129
130 (defcustom rcirc-read-only-flag t 130 (defcustom rcirc-read-only-flag t
131 "*Non-nil means make text in irc buffers read-only." 131 "*Non-nil means make text in IRC buffers read-only."
132 :type 'boolean 132 :type 'boolean
133 :group 'rcirc) 133 :group 'rcirc)
134 134
135 (defcustom rcirc-buffer-maximum-lines nil 135 (defcustom rcirc-buffer-maximum-lines nil
136 "*The maximum size in lines for rcirc buffers. 136 "*The maximum size in lines for rcirc buffers.
165 See also `rcirc-authinfo-file-name'." 165 See also `rcirc-authinfo-file-name'."
166 :type 'boolean 166 :type 'boolean
167 :group 'rcirc) 167 :group 'rcirc)
168 168
169 (defcustom rcirc-prompt "> " 169 (defcustom rcirc-prompt "> "
170 "Prompt string to use in irc buffers. 170 "Prompt string to use in IRC buffers.
171 171
172 The following replacements are made: 172 The following replacements are made:
173 %n is your nick. 173 %n is your nick.
174 %s is the server. 174 %s is the server.
175 %t is the buffer target, a channel or a user. 175 %t is the buffer target, a channel or a user.
352 (defvar rcirc-debug-buffer " *rcirc debug*") 352 (defvar rcirc-debug-buffer " *rcirc debug*")
353 (defvar rcirc-debug-flag nil 353 (defvar rcirc-debug-flag nil
354 "If non-nil, write information to `rcirc-debug-buffer'.") 354 "If non-nil, write information to `rcirc-debug-buffer'.")
355 (defun rcirc-debug (process text) 355 (defun rcirc-debug (process text)
356 "Add an entry to the debug log including PROCESS and TEXT. 356 "Add an entry to the debug log including PROCESS and TEXT.
357 Debug text is written to `rcirc-debug-buffer' if `rcirc-debug-p' 357 Debug text is written to `rcirc-debug-buffer' if `rcirc-debug-flag'
358 is non-nil." 358 is non-nil."
359 (when rcirc-debug-flag 359 (when rcirc-debug-flag
360 (save-excursion 360 (save-excursion
361 (save-window-excursion 361 (save-window-excursion
362 (set-buffer (get-buffer-create rcirc-debug-buffer)) 362 (set-buffer (get-buffer-create rcirc-debug-buffer))
399 (setq ps (cons p ps)))))) 399 (setq ps (cons p ps))))))
400 (process-list)) 400 (process-list))
401 ps)) 401 ps))
402 402
403 (defvar rcirc-receive-message-hooks nil 403 (defvar rcirc-receive-message-hooks nil
404 "Hook functions run when a message is recieved from server. 404 "Hook functions run when a message is received from server.
405 Function is called with PROCESS COMMAND SENDER ARGS and LINE.") 405 Function is called with PROCESS, COMMAND, SENDER, ARGS and LINE.")
406 (defun rcirc-filter (process output) 406 (defun rcirc-filter (process output)
407 "Called when PROCESS receives OUTPUT." 407 "Called when PROCESS receives OUTPUT."
408 (rcirc-debug process output) 408 (rcirc-debug process output)
409 (with-rcirc-process-buffer process 409 (with-rcirc-process-buffer process
410 (setq rcirc-last-server-message-time (current-time)) 410 (setq rcirc-last-server-message-time (current-time))
585 (define-key global-map (kbd "C-c `") 'rcirc-next-active-buffer) 585 (define-key global-map (kbd "C-c `") 'rcirc-next-active-buffer)
586 (define-key global-map (kbd "C-c C-@") 'rcirc-next-active-buffer) 586 (define-key global-map (kbd "C-c C-@") 'rcirc-next-active-buffer)
587 (define-key global-map (kbd "C-c C-SPC") 'rcirc-next-active-buffer) 587 (define-key global-map (kbd "C-c C-SPC") 'rcirc-next-active-buffer)
588 588
589 (defvar rcirc-browse-url-map (make-sparse-keymap) 589 (defvar rcirc-browse-url-map (make-sparse-keymap)
590 "Keymap used ror browsing URLs in `rcirc-mode'.") 590 "Keymap used for browsing URLs in `rcirc-mode'.")
591 591
592 (define-key rcirc-browse-url-map (kbd "RET") 'rcirc-browse-url-at-point) 592 (define-key rcirc-browse-url-map (kbd "RET") 'rcirc-browse-url-at-point)
593 (define-key rcirc-browse-url-map (kbd "<mouse-2>") 'rcirc-browse-url-at-mouse) 593 (define-key rcirc-browse-url-map (kbd "<mouse-2>") 'rcirc-browse-url-at-mouse)
594 594
595 (defvar rcirc-short-buffer-name nil 595 (defvar rcirc-short-buffer-name nil
597 597
598 (defvar rcirc-mode-hook nil 598 (defvar rcirc-mode-hook nil
599 "Hook run when setting up rcirc buffer.") 599 "Hook run when setting up rcirc buffer.")
600 600
601 (defun rcirc-mode (process target) 601 (defun rcirc-mode (process target)
602 "Major mode for irc channel buffers. 602 "Major mode for IRC channel buffers.
603 603
604 \\{rcirc-mode-map}" 604 \\{rcirc-mode-map}"
605 (kill-all-local-variables) 605 (kill-all-local-variables)
606 (use-local-map rcirc-mode-map) 606 (use-local-map rcirc-mode-map)
607 (setq mode-name "rcirc") 607 (setq mode-name "rcirc")
720 720
721 (add-hook 'kill-buffer-hook 'rcirc-kill-buffer-hook) 721 (add-hook 'kill-buffer-hook 'rcirc-kill-buffer-hook)
722 722
723 (defun rcirc-generate-new-buffer-name (process target) 723 (defun rcirc-generate-new-buffer-name (process target)
724 "Return a buffer name based on PROCESS and TARGET. 724 "Return a buffer name based on PROCESS and TARGET.
725 This is used for the initial name given to irc buffers." 725 This is used for the initial name given to IRC buffers."
726 (if target 726 (if target
727 (concat target "@" (process-name process)) 727 (concat target "@" (process-name process))
728 (concat "*" (process-name process) "*"))) 728 (concat "*" (process-name process) "*")))
729 729
730 (defun rcirc-get-buffer (process target &optional server) 730 (defun rcirc-get-buffer (process target &optional server)
983 ((string= response "ACTION") 983 ((string= response "ACTION")
984 (+ (length (rcirc-user-nick sender)) 984 (+ (length (rcirc-user-nick sender))
985 1)) ; [ 985 1)) ; [
986 (t 3)) ; *** 986 (t 3)) ; ***
987 1) 987 1)
988 ? ))) 988 ?\s)))
989 (fill-column (cond ((eq rcirc-fill-column 'frame-width) 989 (fill-column (cond ((eq rcirc-fill-column 'frame-width)
990 (1- (frame-width))) 990 (1- (frame-width)))
991 (rcirc-fill-column 991 (rcirc-fill-column
992 rcirc-fill-column) 992 rcirc-fill-column)
993 (t fill-column)))) 993 (t fill-column))))
1044 (sit-for 0) ; displayed text before hook 1044 (sit-for 0) ; displayed text before hook
1045 (run-hook-with-args 'rcirc-print-hooks 1045 (run-hook-with-args 'rcirc-print-hooks
1046 process sender response target text))))) 1046 process sender response target text)))))
1047 1047
1048 (defun rcirc-startup-channels (server) 1048 (defun rcirc-startup-channels (server)
1049 "Return the list of startup channels for server." 1049 "Return the list of startup channels for SERVER."
1050 (let (channels) 1050 (let (channels)
1051 (dolist (i rcirc-startup-channels-alist) 1051 (dolist (i rcirc-startup-channels-alist)
1052 (if (string-match (car i) server) 1052 (if (string-match (car i) server)
1053 (setq channels (append channels (cdr i))))) 1053 (setq channels (append channels (cdr i)))))
1054 channels)) 1054 channels))
1125 rcirc-nick-table) 1125 rcirc-nick-table)
1126 (mapcar (lambda (x) (car x)) 1126 (mapcar (lambda (x) (car x))
1127 (sort nicks (lambda (x y) (time-less-p (cdr y) (cdr x)))))))) 1127 (sort nicks (lambda (x y) (time-less-p (cdr y) (cdr x))))))))
1128 1128
1129 (defun rcirc-ignore-update-automatic (nick) 1129 (defun rcirc-ignore-update-automatic (nick)
1130 "Remove NICK from `rcirc-ignore-list' 1130 "Remove NICK from `rcirc-ignore-list'
1131 if NICK is also on `rcirc-ignore-list-automatic'." 1131 if NICK is also on `rcirc-ignore-list-automatic'."
1132 (when (member nick rcirc-ignore-list-automatic) 1132 (when (member nick rcirc-ignore-list-automatic)
1133 (setq rcirc-ignore-list-automatic 1133 (setq rcirc-ignore-list-automatic
1134 (delete nick rcirc-ignore-list-automatic) 1134 (delete nick rcirc-ignore-list-automatic)
1135 rcirc-ignore-list 1135 rcirc-ignore-list
1136 (delete nick rcirc-ignore-list)))) 1136 (delete nick rcirc-ignore-list))))
1484 1484
1485 (defun-rcirc-command ignore (nick) 1485 (defun-rcirc-command ignore (nick)
1486 "Manage the ignore list. 1486 "Manage the ignore list.
1487 Ignore NICK, unignore NICK if already ignored, or list ignored 1487 Ignore NICK, unignore NICK if already ignored, or list ignored
1488 nicks when no NICK is given. When listing ignored nicks, the 1488 nicks when no NICK is given. When listing ignored nicks, the
1489 ones added to the list automatically are marked with an asterix." 1489 ones added to the list automatically are marked with an asterisk."
1490 (interactive "sToggle ignoring of nick: ") 1490 (interactive "sToggle ignoring of nick: ")
1491 (if (string= "" nick) 1491 (if (string= "" nick)
1492 (rcirc-print process (rcirc-nick process) "NOTICE" target 1492 (rcirc-print process (rcirc-nick process) "NOTICE" target
1493 (mapconcat 1493 (mapconcat
1494 (lambda (nick) 1494 (lambda (nick)
1495 (concat nick 1495 (concat nick
1496 (if (member nick rcirc-ignore-list-automatic) 1496 (if (member nick rcirc-ignore-list-automatic)
1497 "*" ""))) 1497 "*" "")))
1509 (defun rcirc-facify (string face) 1509 (defun rcirc-facify (string face)
1510 "Return a copy of STRING with FACE property added." 1510 "Return a copy of STRING with FACE property added."
1511 (propertize (or string "") 'face face 'rear-nonsticky t)) 1511 (propertize (or string "") 'face face 'rear-nonsticky t))
1512 1512
1513 (defvar rcirc-url-regexp 1513 (defvar rcirc-url-regexp
1514 (rx word-boundary 1514 (rx word-boundary
1515 (or "www." 1515 (or "www."
1516 (and (or "http" "https" "ftp" "file" "gopher" "news" "telnet" "wais" 1516 (and (or "http" "https" "ftp" "file" "gopher" "news" "telnet" "wais"
1517 "mailto") 1517 "mailto")
1518 "://" 1518 "://"
1519 (1+ (char "a-zA-Z0-9_.")) 1519 (1+ (char "a-zA-Z0-9_."))
1520 (optional ":" (1+ (char "0-9"))))) 1520 (optional ":" (1+ (char "0-9")))))
1521 (1+ (char "-a-zA-Z0-9_=!?#$\@~`%&*+|\\/:;.,")) 1521 (1+ (char "-a-zA-Z0-9_=!?#$\@~`%&*+|\\/:;.,"))
1522 (char "-a-zA-Z0-9_=!?#$\@~`%&*+|\\/:;")) 1522 (char "-a-zA-Z0-9_=!?#$\@~`%&*+|\\/:;"))
1523 "Regexp matching URL's. Set to nil to disable URL features in rcirc.") 1523 "Regexp matching URLs. Set to nil to disable URL features in rcirc.")
1524 1524
1525 (defun rcirc-browse-url (&optional arg) 1525 (defun rcirc-browse-url (&optional arg)
1526 "Prompt for url to browse based on urls in buffer." 1526 "Prompt for URL to browse based on URLs in buffer."
1527 (interactive) 1527 (interactive)
1528 (let ((completions (mapcar (lambda (x) (cons x nil)) rcirc-urls)) 1528 (let ((completions (mapcar (lambda (x) (cons x nil)) rcirc-urls))
1529 (initial-input (car rcirc-urls)) 1529 (initial-input (car rcirc-urls))
1530 (history (cdr rcirc-urls))) 1530 (history (cdr rcirc-urls)))
1531 (browse-url (completing-read "rcirc browse-url: " 1531 (browse-url (completing-read "rcirc browse-url: "
1557 1557
1558 (defun rcirc-mangle-text (process text) 1558 (defun rcirc-mangle-text (process text)
1559 "Return TEXT with properties added based on various patterns." 1559 "Return TEXT with properties added based on various patterns."
1560 ;; ^B 1560 ;; ^B
1561 (setq text 1561 (setq text
1562 (rcirc-map-regexp 1562 (rcirc-map-regexp
1563 (lambda (start end string) 1563 (lambda (start end string)
1564 (let ((orig-face (get-text-property start 'face string))) 1564 (let ((orig-face (get-text-property start 'face string)))
1565 (add-text-properties 1565 (add-text-properties
1566 start end 1566 start end
1567 (list 'face (if (listp orig-face) 1567 (list 'face (if (listp orig-face)
1568 (append orig-face 1568 (append orig-face
1569 (list 'bold)) 1569 (list 'bold))
1570 (list orig-face 'bold)) 1570 (list orig-face 'bold))
1571 'rear-nonsticky t) 1571 'rear-nonsticky t)
1572 string))) 1572 string)))
1573 ".*?" 1573 ".*?"
1574 text)) 1574 text))
1575 ;; TODO: deal with ^_ and ^C colors sequences 1575 ;; TODO: deal with ^_ and ^C colors sequences
1576 (while (string-match "\\(.*\\)[]\\(.*\\)" text) 1576 (while (string-match "\\(.*\\)[]\\(.*\\)" text)
1577 (setq text (concat (match-string 1 text) 1577 (setq text (concat (match-string 1 text)
1578 (match-string 2 text)))) 1578 (match-string 2 text))))
1579 ;; my nick 1579 ;; my nick
1580 (setq text 1580 (setq text
1581 (with-syntax-table rcirc-nick-syntax-table 1581 (with-syntax-table rcirc-nick-syntax-table
1594 (rcirc-map-regexp 1594 (rcirc-map-regexp
1595 (lambda (start end string) 1595 (lambda (start end string)
1596 (let ((orig-face (get-text-property start 'face string))) 1596 (let ((orig-face (get-text-property start 'face string)))
1597 (add-text-properties start end 1597 (add-text-properties start end
1598 (list 'face (if (listp orig-face) 1598 (list 'face (if (listp orig-face)
1599 (append orig-face 1599 (append orig-face
1600 (list 'bold)) 1600 (list 'bold))
1601 (list orig-face 'bold)) 1601 (list orig-face 'bold))
1602 'rear-nonsticky t 1602 'rear-nonsticky t
1603 'mouse-face 'highlight 1603 'mouse-face 'highlight
1604 'keymap rcirc-browse-url-map) 1604 'keymap rcirc-browse-url-map)
1989 1989
1990 (defface rcirc-prompt ; comint-highlight-prompt 1990 (defface rcirc-prompt ; comint-highlight-prompt
1991 '((((min-colors 88) (background dark)) (:foreground "cyan1")) 1991 '((((min-colors 88) (background dark)) (:foreground "cyan1"))
1992 (((background dark)) (:foreground "cyan")) 1992 (((background dark)) (:foreground "cyan"))
1993 (t (:foreground "dark blue"))) 1993 (t (:foreground "dark blue")))
1994 "The face to use to highlight prompts." 1994 "The face used to highlight prompts."
1995 :group 'rcirc-faces) 1995 :group 'rcirc-faces)
1996 1996
1997 (defface rcirc-mode-line-nick 1997 (defface rcirc-mode-line-nick
1998 '((t (:bold t))) 1998 '((t (:bold t)))
1999 "The face used indicate activity directed at you." 1999 "The face used indicate activity directed at you."