diff options
| author | Thien-Thi Nguyen | 2007-06-29 07:32:59 +0000 |
|---|---|---|
| committer | Thien-Thi Nguyen | 2007-06-29 07:32:59 +0000 |
| commit | 0ffab1eb7ae4730f4b42e53ebb7a8eecf04a0f51 (patch) | |
| tree | 975639e9d98db7cff1fc71be9b8940f653414723 | |
| parent | 9b77469afd371c561f5c2c2b14714dd485840d3f (diff) | |
| download | emacs-0ffab1eb7ae4730f4b42e53ebb7a8eecf04a0f51.tar.gz emacs-0ffab1eb7ae4730f4b42e53ebb7a8eecf04a0f51.zip | |
(rcirc-server-alist): Rename from rcirc-connections.
(rcirc-default-full-name): Rename from
rcirc-default-user-full-name.
(rcirc-clear-activity): Make sure RCIRC-ACTIVITY isn't modified.
(rcirc-print): Never ignore messages from ourself.
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/net/rcirc.el | 121 |
2 files changed, 81 insertions, 48 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index aa5bbc212a1..efc8c1dae3a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2007-06-29 Ryan Yeske <rcyeske@gmail.com> | ||
| 2 | |||
| 3 | * net/rcirc.el (rcirc-server-alist): Rename from rcirc-connections. | ||
| 4 | (rcirc-default-full-name): Rename from | ||
| 5 | rcirc-default-user-full-name. | ||
| 6 | (rcirc-clear-activity): Make sure RCIRC-ACTIVITY isn't modified. | ||
| 7 | (rcirc-print): Never ignore messages from ourself. | ||
| 8 | |||
| 1 | 2007-06-29 Stefan Monnier <monnier@iro.umontreal.ca> | 9 | 2007-06-29 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 10 | ||
| 3 | * font-lock.el (lisp-font-lock-keywords-2): Recognize the new \(?1:..\) | 11 | * font-lock.el (lisp-font-lock-keywords-2): Recognize the new \(?1:..\) |
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 04f3fa45ceb..a72dc2fd303 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el | |||
| @@ -55,7 +55,7 @@ | |||
| 55 | :link '(custom-manual "(rcirc)") | 55 | :link '(custom-manual "(rcirc)") |
| 56 | :group 'applications) | 56 | :group 'applications) |
| 57 | 57 | ||
| 58 | (defcustom rcirc-connections | 58 | (defcustom rcirc-server-alist |
| 59 | '(("irc.freenode.net" :channels ("#rcirc"))) | 59 | '(("irc.freenode.net" :channels ("#rcirc"))) |
| 60 | "An alist of IRC connections to establish when running `rcirc'. | 60 | "An alist of IRC connections to establish when running `rcirc'. |
| 61 | Each element looks like (SERVER-NAME PARAMETERS). | 61 | Each element looks like (SERVER-NAME PARAMETERS). |
| @@ -63,11 +63,36 @@ Each element looks like (SERVER-NAME PARAMETERS). | |||
| 63 | SERVER-NAME is a string describing the server to connect | 63 | SERVER-NAME is a string describing the server to connect |
| 64 | to. | 64 | to. |
| 65 | 65 | ||
| 66 | PARAMETERS is a plist of optional connection parameters. Valid | 66 | The optional PARAMETERS come in pairs PARAMETER VALUE. |
| 67 | properties are: nick (a string), port (number or string), | 67 | |
| 68 | user-name (string), full-name (string), and channels (list of | 68 | The following parameters are recognized: |
| 69 | strings)." | 69 | |
| 70 | :type '(alist :key-type string | 70 | `:nick' |
| 71 | |||
| 72 | VALUE must be a string. If absent, `rcirc-default-nick' is used | ||
| 73 | for this connection. | ||
| 74 | |||
| 75 | `:port' | ||
| 76 | |||
| 77 | VALUE must be a number or string. If absent, | ||
| 78 | `rcirc-default-port' is used. | ||
| 79 | |||
| 80 | `:user-name' | ||
| 81 | |||
| 82 | VALUE must be a string. If absent, `rcirc-default-user-name' is | ||
| 83 | used. | ||
| 84 | |||
| 85 | `:full-name' | ||
| 86 | |||
| 87 | VALUE must be a string. If absent, `rcirc-default-full-name' is | ||
| 88 | used. | ||
| 89 | |||
| 90 | `:channels' | ||
| 91 | |||
| 92 | VALUE must be a list of strings describing which channels to join | ||
| 93 | when connecting to this server. If absent, no channels will be | ||
| 94 | connected to automatically." | ||
| 95 | :type '(alist :key-type string | ||
| 71 | :value-type (plist :options ((nick string) | 96 | :value-type (plist :options ((nick string) |
| 72 | (port integer) | 97 | (port integer) |
| 73 | (user-name string) | 98 | (user-name string) |
| @@ -90,9 +115,9 @@ strings)." | |||
| 90 | :type 'string | 115 | :type 'string |
| 91 | :group 'rcirc) | 116 | :group 'rcirc) |
| 92 | 117 | ||
| 93 | (defcustom rcirc-default-user-full-name (if (string= (user-full-name) "") | 118 | (defcustom rcirc-default-full-name (if (string= (user-full-name) "") |
| 94 | rcirc-default-user-name | 119 | rcirc-default-user-name |
| 95 | (user-full-name)) | 120 | (user-full-name)) |
| 96 | "The full name sent to the server when connecting." | 121 | "The full name sent to the server when connecting." |
| 97 | :type 'string | 122 | :type 'string |
| 98 | :group 'rcirc) | 123 | :group 'rcirc) |
| @@ -335,19 +360,19 @@ and the cdr part is used for encoding." | |||
| 335 | 360 | ||
| 336 | ;;;###autoload | 361 | ;;;###autoload |
| 337 | (defun rcirc (arg) | 362 | (defun rcirc (arg) |
| 338 | "Connect to all servers in `rcirc-connections'. | 363 | "Connect to all servers in `rcirc-server-alist'. |
| 339 | 364 | ||
| 340 | Do not connect to a server if it is already connected. | 365 | Do not connect to a server if it is already connected. |
| 341 | 366 | ||
| 342 | If ARG is non-nil, instead prompt for connection parameters." | 367 | If ARG is non-nil, instead prompt for connection parameters." |
| 343 | (interactive "P") | 368 | (interactive "P") |
| 344 | (if arg | 369 | (if arg |
| 345 | (let* ((server (completing-read "IRC Server: " | 370 | (let* ((server (completing-read "IRC Server: " |
| 346 | rcirc-connections | 371 | rcirc-server-alist |
| 347 | nil nil | 372 | nil nil |
| 348 | (caar rcirc-connections))) | 373 | (caar rcirc-server-alist))) |
| 349 | (server-plist (cdr (assoc-string server rcirc-connections))) | 374 | (server-plist (cdr (assoc-string server rcirc-server-alist))) |
| 350 | (port (read-string "IRC Port: " | 375 | (port (read-string "IRC Port: " |
| 351 | (number-to-string | 376 | (number-to-string |
| 352 | (or (plist-get server-plist 'port) | 377 | (or (plist-get server-plist 'port) |
| 353 | rcirc-default-port)))) | 378 | rcirc-default-port)))) |
| @@ -356,25 +381,25 @@ If ARG is non-nil, instead prompt for connection parameters." | |||
| 356 | rcirc-default-nick))) | 381 | rcirc-default-nick))) |
| 357 | (channels (split-string | 382 | (channels (split-string |
| 358 | (read-string "IRC Channels: " | 383 | (read-string "IRC Channels: " |
| 359 | (mapconcat 'identity | 384 | (mapconcat 'identity |
| 360 | (plist-get server-plist | 385 | (plist-get server-plist |
| 361 | 'channels) | 386 | 'channels) |
| 362 | " ")) | 387 | " ")) |
| 363 | "[, ]+" t))) | 388 | "[, ]+" t))) |
| 364 | (rcirc-connect server port nick rcirc-default-user-name | 389 | (rcirc-connect server port nick rcirc-default-user-name |
| 365 | rcirc-default-user-full-name | 390 | rcirc-default-full-name |
| 366 | channels)) | 391 | channels)) |
| 367 | ;; connect to servers in `rcirc-connections' | 392 | ;; connect to servers in `rcirc-server-alist' |
| 368 | (let (connected-servers) | 393 | (let (connected-servers) |
| 369 | (dolist (c rcirc-connections) | 394 | (dolist (c rcirc-server-alist) |
| 370 | (let ((server (car c)) | 395 | (let ((server (car c)) |
| 371 | (port (or (plist-get (cdr c) 'port) rcirc-default-port)) | 396 | (nick (or (plist-get (cdr c) :nick) rcirc-default-nick)) |
| 372 | (nick (or (plist-get (cdr c) 'nick) rcirc-default-nick)) | 397 | (port (or (plist-get (cdr c) :port) rcirc-default-port)) |
| 373 | (user-name (or (plist-get (cdr c) 'user-name) | 398 | (user-name (or (plist-get (cdr c) :user-name) |
| 374 | rcirc-default-user-name)) | 399 | rcirc-default-user-name)) |
| 375 | (full-name (or (plist-get (cdr c) 'full-name) | 400 | (full-name (or (plist-get (cdr c) :full-name) |
| 376 | rcirc-default-user-full-name)) | 401 | rcirc-default-full-name)) |
| 377 | (channels (plist-get (cdr c) 'channels))) | 402 | (channels (plist-get (cdr c) :channels))) |
| 378 | (when server | 403 | (when server |
| 379 | (let (connected) | 404 | (let (connected) |
| 380 | (dolist (p (rcirc-process-list)) | 405 | (dolist (p (rcirc-process-list)) |
| @@ -382,9 +407,9 @@ If ARG is non-nil, instead prompt for connection parameters." | |||
| 382 | (setq connected p))) | 407 | (setq connected p))) |
| 383 | (if (not connected) | 408 | (if (not connected) |
| 384 | (condition-case e | 409 | (condition-case e |
| 385 | (rcirc-connect server port nick user-name | 410 | (rcirc-connect server port nick user-name |
| 386 | full-name channels) | 411 | full-name channels) |
| 387 | (quit (message "Quit connecting to %s" server))) | 412 | (quit (message "Quit connecting to %s" server))) |
| 388 | (with-current-buffer (process-buffer connected) | 413 | (with-current-buffer (process-buffer connected) |
| 389 | (setq connected-servers | 414 | (setq connected-servers |
| 390 | (cons (process-contact (get-buffer-process | 415 | (cons (process-contact (get-buffer-process |
| @@ -411,7 +436,7 @@ If ARG is non-nil, instead prompt for connection parameters." | |||
| 411 | (defvar rcirc-process nil) | 436 | (defvar rcirc-process nil) |
| 412 | 437 | ||
| 413 | ;;;###autoload | 438 | ;;;###autoload |
| 414 | (defun rcirc-connect (server &optional port nick user-name full-name | 439 | (defun rcirc-connect (server &optional port nick user-name full-name |
| 415 | startup-channels) | 440 | startup-channels) |
| 416 | (save-excursion | 441 | (save-excursion |
| 417 | (message "Connecting to %s..." server) | 442 | (message "Connecting to %s..." server) |
| @@ -423,7 +448,7 @@ If ARG is non-nil, instead prompt for connection parameters." | |||
| 423 | rcirc-default-port)) | 448 | rcirc-default-port)) |
| 424 | (nick (or nick rcirc-default-nick)) | 449 | (nick (or nick rcirc-default-nick)) |
| 425 | (user-name (or user-name rcirc-default-user-name)) | 450 | (user-name (or user-name rcirc-default-user-name)) |
| 426 | (full-name (or full-name rcirc-default-user-full-name)) | 451 | (full-name (or full-name rcirc-default-full-name)) |
| 427 | (startup-channels startup-channels) | 452 | (startup-channels startup-channels) |
| 428 | (process (make-network-process :name server :host server :service port-number))) | 453 | (process (make-network-process :name server :host server :service port-number))) |
| 429 | ;; set up process | 454 | ;; set up process |
| @@ -494,7 +519,7 @@ last ping." | |||
| 494 | (mapc (lambda (process) | 519 | (mapc (lambda (process) |
| 495 | (with-rcirc-process-buffer process | 520 | (with-rcirc-process-buffer process |
| 496 | (when (not rcirc-connecting) | 521 | (when (not rcirc-connecting) |
| 497 | (rcirc-send-string process | 522 | (rcirc-send-string process |
| 498 | (format "PRIVMSG %s :\C-aKEEPALIVE %f\C-a" | 523 | (format "PRIVMSG %s :\C-aKEEPALIVE %f\C-a" |
| 499 | rcirc-nick | 524 | rcirc-nick |
| 500 | (time-to-seconds | 525 | (time-to-seconds |
| @@ -550,7 +575,7 @@ Functions are called with PROCESS and SENTINEL arguments.") | |||
| 550 | ;; set rcirc-target to nil for each channel so cleanup | 575 | ;; set rcirc-target to nil for each channel so cleanup |
| 551 | ;; doesnt happen when we reconnect | 576 | ;; doesnt happen when we reconnect |
| 552 | (setq rcirc-target nil) | 577 | (setq rcirc-target nil) |
| 553 | (setq mode-line-process ":disconnected"))) | 578 | (setq mode-line-process ":disconnected"))) |
| 554 | 579 | ||
| 555 | (defun rcirc-process-list () | 580 | (defun rcirc-process-list () |
| 556 | "Return a list of rcirc processes." | 581 | "Return a list of rcirc processes." |
| @@ -590,7 +615,6 @@ Function is called with PROCESS, COMMAND, SENDER, ARGS and LINE.") | |||
| 590 | process)))))) | 615 | process)))))) |
| 591 | 616 | ||
| 592 | (defun rcirc-delete-process (process) | 617 | (defun rcirc-delete-process (process) |
| 593 | (message "delete process %S" process) | ||
| 594 | (delete-process process)) | 618 | (delete-process process)) |
| 595 | 619 | ||
| 596 | (defvar rcirc-trap-errors-flag t) | 620 | (defvar rcirc-trap-errors-flag t) |
| @@ -1162,7 +1186,7 @@ the of the following escape sequences replaced by the described values: | |||
| 1162 | :value-type string) | 1186 | :value-type string) |
| 1163 | :group 'rcirc) | 1187 | :group 'rcirc) |
| 1164 | 1188 | ||
| 1165 | (defcustom rcirc-omit-responses | 1189 | (defcustom rcirc-omit-responses |
| 1166 | '("JOIN" "PART" "QUIT") | 1190 | '("JOIN" "PART" "QUIT") |
| 1167 | "Responses which will be hidden when `rcirc-omit-mode' is enabled." | 1191 | "Responses which will be hidden when `rcirc-omit-mode' is enabled." |
| 1168 | :type '(repeat string) | 1192 | :type '(repeat string) |
| @@ -1202,7 +1226,7 @@ is found by looking up RESPONSE in `rcirc-response-formats'." | |||
| 1202 | (cond ((string= sender my-nick) | 1226 | (cond ((string= sender my-nick) |
| 1203 | 'rcirc-my-nick) | 1227 | 'rcirc-my-nick) |
| 1204 | ((and rcirc-bright-nicks | 1228 | ((and rcirc-bright-nicks |
| 1205 | (string-match | 1229 | (string-match |
| 1206 | (regexp-opt rcirc-bright-nicks | 1230 | (regexp-opt rcirc-bright-nicks |
| 1207 | 'words) | 1231 | 'words) |
| 1208 | sender)) | 1232 | sender)) |
| @@ -1262,11 +1286,12 @@ Logfiles are kept in `rcirc-log-directory'." | |||
| 1262 | Format based on SENDER and RESPONSE. If ACTIVITY is non-nil, | 1286 | Format based on SENDER and RESPONSE. If ACTIVITY is non-nil, |
| 1263 | record activity." | 1287 | record activity." |
| 1264 | (or text (setq text "")) | 1288 | (or text (setq text "")) |
| 1265 | (unless (or (member sender rcirc-ignore-list) | 1289 | (unless (and (or (member sender rcirc-ignore-list) |
| 1266 | (member (with-syntax-table rcirc-nick-syntax-table | 1290 | (member (with-syntax-table rcirc-nick-syntax-table |
| 1267 | (when (string-match "^\\([^/]\\w*\\)[:,]" text) | 1291 | (when (string-match "^\\([^/]\\w*\\)[:,]" text) |
| 1268 | (match-string 1 text))) | 1292 | (match-string 1 text))) |
| 1269 | rcirc-ignore-list)) | 1293 | rcirc-ignore-list)) |
| 1294 | (not (string= sender (rcirc-nick process)))) | ||
| 1270 | (let* ((buffer (rcirc-target-buffer process sender response target text)) | 1295 | (let* ((buffer (rcirc-target-buffer process sender response target text)) |
| 1271 | (inhibit-read-only t)) | 1296 | (inhibit-read-only t)) |
| 1272 | (with-current-buffer buffer | 1297 | (with-current-buffer buffer |
| @@ -1291,12 +1316,12 @@ record activity." | |||
| 1291 | (set-marker-insertion-type rcirc-prompt-end-marker t) | 1316 | (set-marker-insertion-type rcirc-prompt-end-marker t) |
| 1292 | 1317 | ||
| 1293 | (let ((start (point))) | 1318 | (let ((start (point))) |
| 1294 | (insert (rcirc-format-response-string process sender response nil | 1319 | (insert (rcirc-format-response-string process sender response nil |
| 1295 | text) | 1320 | text) |
| 1296 | (propertize "\n" 'hard t)) | 1321 | (propertize "\n" 'hard t)) |
| 1297 | 1322 | ||
| 1298 | ;; squeeze spaces out of text before rcirc-text | 1323 | ;; squeeze spaces out of text before rcirc-text |
| 1299 | (fill-region fill-start | 1324 | (fill-region fill-start |
| 1300 | (1- (or (next-single-property-change fill-start | 1325 | (1- (or (next-single-property-change fill-start |
| 1301 | 'rcirc-text) | 1326 | 'rcirc-text) |
| 1302 | rcirc-prompt-end-marker))) | 1327 | rcirc-prompt-end-marker))) |
| @@ -1549,7 +1574,7 @@ if NICK is also on `rcirc-ignore-list-automatic'." | |||
| 1549 | 1574 | ||
| 1550 | (defun rcirc-omit-mode () | 1575 | (defun rcirc-omit-mode () |
| 1551 | "Toggle the Rcirc-Omit mode. | 1576 | "Toggle the Rcirc-Omit mode. |
| 1552 | If enabled, \"uninteresting\" lines are not shown. | 1577 | If enabled, \"uninteresting\" lines are not shown. |
| 1553 | Uninteresting lines are those whose responses are listed in | 1578 | Uninteresting lines are those whose responses are listed in |
| 1554 | `rcirc-omit-responses'." | 1579 | `rcirc-omit-responses'." |
| 1555 | (interactive) | 1580 | (interactive) |
| @@ -1635,7 +1660,7 @@ activity. Only run if the buffer is not visible and | |||
| 1635 | 1660 | ||
| 1636 | (defun rcirc-clear-activity (buffer) | 1661 | (defun rcirc-clear-activity (buffer) |
| 1637 | "Clear the BUFFER activity." | 1662 | "Clear the BUFFER activity." |
| 1638 | (setq rcirc-activity (delete buffer rcirc-activity)) | 1663 | (setq rcirc-activity (remove buffer rcirc-activity)) |
| 1639 | (with-current-buffer buffer | 1664 | (with-current-buffer buffer |
| 1640 | (setq rcirc-activity-types nil))) | 1665 | (setq rcirc-activity-types nil))) |
| 1641 | 1666 | ||
| @@ -2065,7 +2090,7 @@ keywords when no KEYWORD is given." | |||
| 2065 | rcirc-markup-keywords | 2090 | rcirc-markup-keywords |
| 2066 | rcirc-markup-bright-nicks | 2091 | rcirc-markup-bright-nicks |
| 2067 | rcirc-markup-fill) | 2092 | rcirc-markup-fill) |
| 2068 | 2093 | ||
| 2069 | "List of functions used to manipulate text before it is printed. | 2094 | "List of functions used to manipulate text before it is printed. |
| 2070 | 2095 | ||
| 2071 | Each function takes two arguments, SENDER, RESPONSE. The buffer | 2096 | Each function takes two arguments, SENDER, RESPONSE. The buffer |
| @@ -2074,7 +2099,7 @@ beginning of the `rcirc-text' propertized text.") | |||
| 2074 | 2099 | ||
| 2075 | (defun rcirc-markup-timestamp (sender response) | 2100 | (defun rcirc-markup-timestamp (sender response) |
| 2076 | (goto-char (point-min)) | 2101 | (goto-char (point-min)) |
| 2077 | (insert (rcirc-facify (format-time-string rcirc-time-format) | 2102 | (insert (rcirc-facify (format-time-string rcirc-time-format) |
| 2078 | 'rcirc-timestamp))) | 2103 | 'rcirc-timestamp))) |
| 2079 | 2104 | ||
| 2080 | (defun rcirc-markup-attributes (sender response) | 2105 | (defun rcirc-markup-attributes (sender response) |
| @@ -2095,15 +2120,15 @@ beginning of the `rcirc-text' propertized text.") | |||
| 2095 | 2120 | ||
| 2096 | (defun rcirc-markup-my-nick (sender response) | 2121 | (defun rcirc-markup-my-nick (sender response) |
| 2097 | (with-syntax-table rcirc-nick-syntax-table | 2122 | (with-syntax-table rcirc-nick-syntax-table |
| 2098 | (while (re-search-forward (concat "\\b" | 2123 | (while (re-search-forward (concat "\\b" |
| 2099 | (regexp-quote (rcirc-nick | 2124 | (regexp-quote (rcirc-nick |
| 2100 | (rcirc-buffer-process))) | 2125 | (rcirc-buffer-process))) |
| 2101 | "\\b") | 2126 | "\\b") |
| 2102 | nil t) | 2127 | nil t) |
| 2103 | (rcirc-add-face (match-beginning 0) (match-end 0) | 2128 | (rcirc-add-face (match-beginning 0) (match-end 0) |
| 2104 | 'rcirc-nick-in-message) | 2129 | 'rcirc-nick-in-message) |
| 2105 | (when (string= response "PRIVMSG") | 2130 | (when (string= response "PRIVMSG") |
| 2106 | (rcirc-add-face (point-min) (point-max) | 2131 | (rcirc-add-face (point-min) (point-max) |
| 2107 | 'rcirc-nick-in-message-full-line) | 2132 | 'rcirc-nick-in-message-full-line) |
| 2108 | (rcirc-record-activity (current-buffer) 'nick))))) | 2133 | (rcirc-record-activity (current-buffer) 'nick))))) |
| 2109 | 2134 | ||