diff options
| author | Leo Liu | 2014-04-08 11:32:37 +0800 |
|---|---|---|
| committer | Leo Liu | 2014-04-08 11:32:37 +0800 |
| commit | dc0b0454feb676cbe54137babff4c9bf55ec6719 (patch) | |
| tree | 6d649b8be60c702cc440ba6d2a2ac369ab314d03 | |
| parent | 6f287c898ab29c97bd90293df5f83af0e72c7ec7 (diff) | |
| download | emacs-dc0b0454feb676cbe54137babff4c9bf55ec6719.tar.gz emacs-dc0b0454feb676cbe54137babff4c9bf55ec6719.zip | |
Use lexical-binding and require cl-lib
* net/rcirc.el (rcirc, rcirc-handler-ctcp-KEEPALIVE)
(rcirc-handler-generic, rcirc-fill-paragraph)
(rcirc-format-response-string, rcirc-target-buffer)
(rcirc-last-line, rcirc-record-activity, rcirc-split-activity)
(rcirc-activity-string, rcirc-make-trees, rcirc-cmd-ctcp)
(rcirc-ctcp-sender-PING, rcirc-browse-url)
(rcirc-markup-timestamp, rcirc-markup-attributes)
(rcirc-markup-my-nick, rcirc-markup-urls)
(rcirc-markup-bright-nicks, rcirc-markup-fill)
(rcirc-check-auth-status, rcirc-handler-WALLOPS)
(rcirc-handler-JOIN, rcirc-handler-PART-or-KICK)
(rcirc-handler-PART, rcirc-handler-KICK, rcirc-handler-QUIT)
(rcirc-handler-NICK, rcirc-handler-PING, rcirc-handler-PONG)
(rcirc-handler-TOPIC, rcirc-handler-301, rcirc-handler-317)
(rcirc-handler-332, rcirc-handler-333, rcirc-handler-477)
(rcirc-handler-MODE, rcirc-handler-353, rcirc-handler-366)
(rcirc-authenticate, rcirc-handler-INVITE, rcirc-handler-ERROR)
(rcirc-handler-ctcp-VERSION, rcirc-handler-ctcp-TIME)
(rcirc-handler-CTCP-response): Fix unused arguments warnings and
use cl-lib.
| -rw-r--r-- | lisp/ChangeLog | 24 | ||||
| -rw-r--r-- | lisp/net/rcirc.el | 140 |
2 files changed, 93 insertions, 71 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6fd5c99dc92..6161051faf3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,27 @@ | |||
| 1 | 2014-04-08 Leo Liu <sdl.web@gmail.com> | ||
| 2 | |||
| 3 | Use lexical-binding and require cl-lib. | ||
| 4 | * net/rcirc.el (rcirc, rcirc-handler-ctcp-KEEPALIVE) | ||
| 5 | (rcirc-handler-generic, rcirc-fill-paragraph) | ||
| 6 | (rcirc-format-response-string, rcirc-target-buffer) | ||
| 7 | (rcirc-last-line, rcirc-record-activity, rcirc-split-activity) | ||
| 8 | (rcirc-activity-string, rcirc-make-trees, rcirc-cmd-ctcp) | ||
| 9 | (rcirc-ctcp-sender-PING, rcirc-browse-url) | ||
| 10 | (rcirc-markup-timestamp, rcirc-markup-attributes) | ||
| 11 | (rcirc-markup-my-nick, rcirc-markup-urls) | ||
| 12 | (rcirc-markup-bright-nicks, rcirc-markup-fill) | ||
| 13 | (rcirc-check-auth-status, rcirc-handler-WALLOPS) | ||
| 14 | (rcirc-handler-JOIN, rcirc-handler-PART-or-KICK) | ||
| 15 | (rcirc-handler-PART, rcirc-handler-KICK, rcirc-handler-QUIT) | ||
| 16 | (rcirc-handler-NICK, rcirc-handler-PING, rcirc-handler-PONG) | ||
| 17 | (rcirc-handler-TOPIC, rcirc-handler-301, rcirc-handler-317) | ||
| 18 | (rcirc-handler-332, rcirc-handler-333, rcirc-handler-477) | ||
| 19 | (rcirc-handler-MODE, rcirc-handler-353, rcirc-handler-366) | ||
| 20 | (rcirc-authenticate, rcirc-handler-INVITE, rcirc-handler-ERROR) | ||
| 21 | (rcirc-handler-ctcp-VERSION, rcirc-handler-ctcp-TIME) | ||
| 22 | (rcirc-handler-CTCP-response): Fix unused arguments warnings and | ||
| 23 | use cl-lib. | ||
| 24 | |||
| 1 | 2014-04-07 João Távora <joaotavora@gmail.com> | 25 | 2014-04-07 João Távora <joaotavora@gmail.com> |
| 2 | 26 | ||
| 3 | * elec-pair.el (electric-pair--syntax-ppss): | 27 | * elec-pair.el (electric-pair--syntax-ppss): |
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 2591fc83e84..f129bfe6783 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el | |||
| @@ -1,10 +1,10 @@ | |||
| 1 | ;;; rcirc.el --- default, simple IRC client. | 1 | ;;; rcirc.el --- default, simple IRC client -*- lexical-binding: t; -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2005-2014 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2005-2014 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Ryan Yeske <rcyeske@gmail.com> | 5 | ;; Author: Ryan Yeske <rcyeske@gmail.com> |
| 6 | ;; Maintainers: Ryan Yeske <rcyeske@gmail.com>, | 6 | ;; Maintainers: Ryan Yeske <rcyeske@gmail.com>, |
| 7 | ;; Deniz Dogan <deniz@dogan.se> | 7 | ;; Leo Liu <sdl.web@gmail.com> |
| 8 | ;; Keywords: comm | 8 | ;; Keywords: comm |
| 9 | 9 | ||
| 10 | ;; This file is part of GNU Emacs. | 10 | ;; This file is part of GNU Emacs. |
| @@ -43,9 +43,9 @@ | |||
| 43 | 43 | ||
| 44 | ;;; Code: | 44 | ;;; Code: |
| 45 | 45 | ||
| 46 | (require 'cl-lib) | ||
| 46 | (require 'ring) | 47 | (require 'ring) |
| 47 | (require 'time-date) | 48 | (require 'time-date) |
| 48 | (eval-when-compile (require 'cl)) | ||
| 49 | 49 | ||
| 50 | (defgroup rcirc nil | 50 | (defgroup rcirc nil |
| 51 | "Simple IRC client." | 51 | "Simple IRC client." |
| @@ -489,7 +489,7 @@ If ARG is non-nil, instead prompt for connection parameters." | |||
| 489 | (when (string= server (process-name p)) | 489 | (when (string= server (process-name p)) |
| 490 | (setq connected p))) | 490 | (setq connected p))) |
| 491 | (if (not connected) | 491 | (if (not connected) |
| 492 | (condition-case e | 492 | (condition-case nil |
| 493 | (rcirc-connect server port nick user-name | 493 | (rcirc-connect server port nick user-name |
| 494 | full-name channels password encryption) | 494 | full-name channels password encryption) |
| 495 | (quit (message "Quit connecting to %s" server))) | 495 | (quit (message "Quit connecting to %s" server))) |
| @@ -629,7 +629,7 @@ last ping." | |||
| 629 | (cancel-timer rcirc-keepalive-timer)) | 629 | (cancel-timer rcirc-keepalive-timer)) |
| 630 | (setq rcirc-keepalive-timer nil))) | 630 | (setq rcirc-keepalive-timer nil))) |
| 631 | 631 | ||
| 632 | (defun rcirc-handler-ctcp-KEEPALIVE (process target sender message) | 632 | (defun rcirc-handler-ctcp-KEEPALIVE (process _target _sender message) |
| 633 | (with-rcirc-process-buffer process | 633 | (with-rcirc-process-buffer process |
| 634 | (setq header-line-format (format "%f" (- (rcirc-float-time) | 634 | (setq header-line-format (format "%f" (- (rcirc-float-time) |
| 635 | (string-to-number message)))))) | 635 | (string-to-number message)))))) |
| @@ -752,7 +752,7 @@ Function is called with PROCESS, COMMAND, SENDER, ARGS and LINE.") | |||
| 752 | (defvar rcirc-responses-no-activity '("305" "306") | 752 | (defvar rcirc-responses-no-activity '("305" "306") |
| 753 | "Responses that don't trigger activity in the mode-line indicator.") | 753 | "Responses that don't trigger activity in the mode-line indicator.") |
| 754 | 754 | ||
| 755 | (defun rcirc-handler-generic (process response sender args text) | 755 | (defun rcirc-handler-generic (process response sender args _text) |
| 756 | "Generic server response handler." | 756 | "Generic server response handler." |
| 757 | (rcirc-print process sender response nil | 757 | (rcirc-print process sender response nil |
| 758 | (mapconcat 'identity (cdr args) " ") | 758 | (mapconcat 'identity (cdr args) " ") |
| @@ -1222,13 +1222,13 @@ Create the buffer if it doesn't exist." | |||
| 1222 | (ring-insert rcirc-input-ring input) | 1222 | (ring-insert rcirc-input-ring input) |
| 1223 | (setq rcirc-input-ring-index 0)))))) | 1223 | (setq rcirc-input-ring-index 0)))))) |
| 1224 | 1224 | ||
| 1225 | (defun rcirc-fill-paragraph (&optional arg) | 1225 | (defun rcirc-fill-paragraph (&optional justify) |
| 1226 | (interactive "p") | 1226 | (interactive "P") |
| 1227 | (when (> (point) rcirc-prompt-end-marker) | 1227 | (when (> (point) rcirc-prompt-end-marker) |
| 1228 | (save-restriction | 1228 | (save-restriction |
| 1229 | (narrow-to-region rcirc-prompt-end-marker (point-max)) | 1229 | (narrow-to-region rcirc-prompt-end-marker (point-max)) |
| 1230 | (let ((fill-column rcirc-max-message-length)) | 1230 | (let ((fill-column rcirc-max-message-length)) |
| 1231 | (fill-region (point-min) (point-max)))))) | 1231 | (fill-region (point-min) (point-max) justify))))) |
| 1232 | 1232 | ||
| 1233 | (defun rcirc-process-input-line (line) | 1233 | (defun rcirc-process-input-line (line) |
| 1234 | (if (string-match "^/\\([^ ]+\\) ?\\(.*\\)$" line) | 1234 | (if (string-match "^/\\([^ ]+\\) ?\\(.*\\)$" line) |
| @@ -1393,9 +1393,9 @@ is found by looking up RESPONSE in `rcirc-response-formats'." | |||
| 1393 | (rcirc-add-face start (match-beginning 0) face) | 1393 | (rcirc-add-face start (match-beginning 0) face) |
| 1394 | (setq start (match-beginning 0)) | 1394 | (setq start (match-beginning 0)) |
| 1395 | (replace-match | 1395 | (replace-match |
| 1396 | (case (aref (match-string 1) 0) | 1396 | (cl-case (aref (match-string 1) 0) |
| 1397 | (?f (setq face | 1397 | (?f (setq face |
| 1398 | (case (string-to-char (match-string 3)) | 1398 | (cl-case (string-to-char (match-string 3)) |
| 1399 | (?w 'font-lock-warning-face) | 1399 | (?w 'font-lock-warning-face) |
| 1400 | (?p 'rcirc-server-prefix) | 1400 | (?p 'rcirc-server-prefix) |
| 1401 | (?s 'rcirc-server) | 1401 | (?s 'rcirc-server) |
| @@ -1431,9 +1431,9 @@ is found by looking up RESPONSE in `rcirc-response-formats'." | |||
| 1431 | (rcirc-add-face start (match-beginning 0) face)) | 1431 | (rcirc-add-face start (match-beginning 0) face)) |
| 1432 | (buffer-substring (point-min) (point-max)))) | 1432 | (buffer-substring (point-min) (point-max)))) |
| 1433 | 1433 | ||
| 1434 | (defun rcirc-target-buffer (process sender response target text) | 1434 | (defun rcirc-target-buffer (process sender response target _text) |
| 1435 | "Return a buffer to print the server response." | 1435 | "Return a buffer to print the server response." |
| 1436 | (assert (not (bufferp target))) | 1436 | (cl-assert (not (bufferp target))) |
| 1437 | (with-rcirc-process-buffer process | 1437 | (with-rcirc-process-buffer process |
| 1438 | (cond ((not target) | 1438 | (cond ((not target) |
| 1439 | (rcirc-any-buffer process)) | 1439 | (rcirc-any-buffer process)) |
| @@ -1474,11 +1474,10 @@ Returns nil if the information is not recorded." | |||
| 1474 | 1474 | ||
| 1475 | (defun rcirc-last-line (process nick target) | 1475 | (defun rcirc-last-line (process nick target) |
| 1476 | "Return the line from the last activity from NICK in TARGET." | 1476 | "Return the line from the last activity from NICK in TARGET." |
| 1477 | (let* ((chanbuf (rcirc-get-buffer process target)) | 1477 | (let ((line (or (cdr (assoc-string target |
| 1478 | (line (or (cdr (assoc-string target | 1478 | (gethash nick (with-rcirc-server-buffer |
| 1479 | (gethash nick (with-rcirc-server-buffer | 1479 | rcirc-nick-table)) t)) |
| 1480 | rcirc-nick-table)) t)) | 1480 | (rcirc-last-quit-line process nick target)))) |
| 1481 | (rcirc-last-quit-line process nick target)))) | ||
| 1482 | (if line | 1481 | (if line |
| 1483 | line | 1482 | line |
| 1484 | ;;(message "line is nil for %s in %s" nick target) | 1483 | ;;(message "line is nil for %s in %s" nick target) |
| @@ -1956,7 +1955,7 @@ activity. Only run if the buffer is not visible and | |||
| 1956 | (let ((t1 (with-current-buffer b1 rcirc-last-post-time)) | 1955 | (let ((t1 (with-current-buffer b1 rcirc-last-post-time)) |
| 1957 | (t2 (with-current-buffer b2 rcirc-last-post-time))) | 1956 | (t2 (with-current-buffer b2 rcirc-last-post-time))) |
| 1958 | (time-less-p t2 t1))))) | 1957 | (time-less-p t2 t1))))) |
| 1959 | (pushnew type rcirc-activity-types) | 1958 | (cl-pushnew type rcirc-activity-types) |
| 1960 | (unless (and (equal rcirc-activity old-activity) | 1959 | (unless (and (equal rcirc-activity old-activity) |
| 1961 | (member type old-types)) | 1960 | (member type old-types)) |
| 1962 | (rcirc-update-activity-string))))) | 1961 | (rcirc-update-activity-string))))) |
| @@ -1977,13 +1976,13 @@ activity. Only run if the buffer is not visible and | |||
| 1977 | (defun rcirc-split-activity (activity) | 1976 | (defun rcirc-split-activity (activity) |
| 1978 | "Return a cons cell with ACTIVITY split into (lopri . hipri)." | 1977 | "Return a cons cell with ACTIVITY split into (lopri . hipri)." |
| 1979 | (let (lopri hipri) | 1978 | (let (lopri hipri) |
| 1980 | (dolist (buf rcirc-activity) | 1979 | (dolist (buf activity) |
| 1981 | (with-current-buffer buf | 1980 | (with-current-buffer buf |
| 1982 | (if (and rcirc-low-priority-flag | 1981 | (if (and rcirc-low-priority-flag |
| 1983 | (not (member 'nick rcirc-activity-types))) | 1982 | (not (member 'nick rcirc-activity-types))) |
| 1984 | (add-to-list 'lopri buf t) | 1983 | (push buf lopri) |
| 1985 | (add-to-list 'hipri buf t)))) | 1984 | (push buf hipri)))) |
| 1986 | (cons lopri hipri))) | 1985 | (cons (nreverse lopri) (nreverse hipri)))) |
| 1987 | 1986 | ||
| 1988 | (defvar rcirc-update-activity-string-hook nil | 1987 | (defvar rcirc-update-activity-string-hook nil |
| 1989 | "Hook run whenever the activity string is updated.") | 1988 | "Hook run whenever the activity string is updated.") |
| @@ -2015,7 +2014,7 @@ activity. Only run if the buffer is not visible and | |||
| 2015 | (with-current-buffer b | 2014 | (with-current-buffer b |
| 2016 | (dolist (type rcirc-activity-types) | 2015 | (dolist (type rcirc-activity-types) |
| 2017 | (rcirc-add-face 0 (length s) | 2016 | (rcirc-add-face 0 (length s) |
| 2018 | (case type | 2017 | (cl-case type |
| 2019 | (nick 'rcirc-track-nick) | 2018 | (nick 'rcirc-track-nick) |
| 2020 | (keyword 'rcirc-track-keyword)) | 2019 | (keyword 'rcirc-track-keyword)) |
| 2021 | s))) | 2020 | s))) |
| @@ -2123,7 +2122,7 @@ activity. Only run if the buffer is not visible and | |||
| 2123 | (when (and (listp x) (listp (cadr x))) | 2122 | (when (and (listp x) (listp (cadr x))) |
| 2124 | (setcdr x (if (> (length (cdr x)) 1) | 2123 | (setcdr x (if (> (length (cdr x)) 1) |
| 2125 | (rcirc-make-trees (cdr x)) | 2124 | (rcirc-make-trees (cdr x)) |
| 2126 | (setcdr x (list (cdadr x))))))) | 2125 | (setcdr x (list (cl-cdadr x))))))) |
| 2127 | alist))) | 2126 | alist))) |
| 2128 | 2127 | ||
| 2129 | ;;; /commands these are called with 3 args: PROCESS, TARGET, which is | 2128 | ;;; /commands these are called with 3 args: PROCESS, TARGET, which is |
| @@ -2281,7 +2280,7 @@ With a prefix arg, prompt for new topic." | |||
| 2281 | (mapconcat 'identity (cdr arglist) " ")))) | 2280 | (mapconcat 'identity (cdr arglist) " ")))) |
| 2282 | (rcirc-send-string process (concat "KICK " target " " argstring)))) | 2281 | (rcirc-send-string process (concat "KICK " target " " argstring)))) |
| 2283 | 2282 | ||
| 2284 | (defun rcirc-cmd-ctcp (args &optional process target) | 2283 | (defun rcirc-cmd-ctcp (args &optional process _target) |
| 2285 | (if (string-match "^\\([^ ]+\\)\\s-+\\(.+\\)$" args) | 2284 | (if (string-match "^\\([^ ]+\\)\\s-+\\(.+\\)$" args) |
| 2286 | (let* ((target (match-string 1 args)) | 2285 | (let* ((target (match-string 1 args)) |
| 2287 | (request (upcase (match-string 2 args))) | 2286 | (request (upcase (match-string 2 args))) |
| @@ -2292,7 +2291,7 @@ With a prefix arg, prompt for new topic." | |||
| 2292 | (rcirc-print process (rcirc-nick process) "ERROR" nil | 2291 | (rcirc-print process (rcirc-nick process) "ERROR" nil |
| 2293 | "usage: /ctcp NICK REQUEST"))) | 2292 | "usage: /ctcp NICK REQUEST"))) |
| 2294 | 2293 | ||
| 2295 | (defun rcirc-ctcp-sender-PING (process target request) | 2294 | (defun rcirc-ctcp-sender-PING (process target _request) |
| 2296 | "Send a CTCP PING message to TARGET." | 2295 | "Send a CTCP PING message to TARGET." |
| 2297 | (let ((timestamp (format "%.0f" (rcirc-float-time)))) | 2296 | (let ((timestamp (format "%.0f" (rcirc-float-time)))) |
| 2298 | (rcirc-send-ctcp process target "PING" timestamp))) | 2297 | (rcirc-send-ctcp process target "PING" timestamp))) |
| @@ -2412,21 +2411,20 @@ If ARG is given, opens the URL in a new browser window." | |||
| 2412 | (lambda (x) (>= point (cdr x))) | 2411 | (lambda (x) (>= point (cdr x))) |
| 2413 | rcirc-urls)) | 2412 | rcirc-urls)) |
| 2414 | (completions (mapcar (lambda (x) (car x)) filtered)) | 2413 | (completions (mapcar (lambda (x) (car x)) filtered)) |
| 2415 | (initial-input (caar filtered)) | 2414 | (defaults (mapcar (lambda (x) (car x)) filtered))) |
| 2416 | (history (mapcar (lambda (x) (car x)) (cdr filtered)))) | 2415 | (browse-url (completing-read "Rcirc browse-url: " |
| 2417 | (browse-url (completing-read "rcirc browse-url: " | 2416 | completions nil nil (car defaults) nil defaults) |
| 2418 | completions nil nil initial-input 'history) | ||
| 2419 | arg))) | 2417 | arg))) |
| 2420 | 2418 | ||
| 2421 | (defun rcirc-markup-timestamp (sender response) | 2419 | (defun rcirc-markup-timestamp (_sender _response) |
| 2422 | (goto-char (point-min)) | 2420 | (goto-char (point-min)) |
| 2423 | (insert (rcirc-facify (format-time-string rcirc-time-format) | 2421 | (insert (rcirc-facify (format-time-string rcirc-time-format) |
| 2424 | 'rcirc-timestamp))) | 2422 | 'rcirc-timestamp))) |
| 2425 | 2423 | ||
| 2426 | (defun rcirc-markup-attributes (sender response) | 2424 | (defun rcirc-markup-attributes (_sender _response) |
| 2427 | (while (re-search-forward "\\([\C-b\C-_\C-v]\\).*?\\(\\1\\|\C-o\\)" nil t) | 2425 | (while (re-search-forward "\\([\C-b\C-_\C-v]\\).*?\\(\\1\\|\C-o\\)" nil t) |
| 2428 | (rcirc-add-face (match-beginning 0) (match-end 0) | 2426 | (rcirc-add-face (match-beginning 0) (match-end 0) |
| 2429 | (case (char-after (match-beginning 1)) | 2427 | (cl-case (char-after (match-beginning 1)) |
| 2430 | (?\C-b 'bold) | 2428 | (?\C-b 'bold) |
| 2431 | (?\C-v 'italic) | 2429 | (?\C-v 'italic) |
| 2432 | (?\C-_ 'underline))) | 2430 | (?\C-_ 'underline))) |
| @@ -2440,7 +2438,7 @@ If ARG is given, opens the URL in a new browser window." | |||
| 2440 | (while (re-search-forward "\C-o+" nil t) | 2438 | (while (re-search-forward "\C-o+" nil t) |
| 2441 | (delete-region (match-beginning 0) (match-end 0)))) | 2439 | (delete-region (match-beginning 0) (match-end 0)))) |
| 2442 | 2440 | ||
| 2443 | (defun rcirc-markup-my-nick (sender response) | 2441 | (defun rcirc-markup-my-nick (_sender response) |
| 2444 | (with-syntax-table rcirc-nick-syntax-table | 2442 | (with-syntax-table rcirc-nick-syntax-table |
| 2445 | (while (re-search-forward (concat "\\b" | 2443 | (while (re-search-forward (concat "\\b" |
| 2446 | (regexp-quote (rcirc-nick | 2444 | (regexp-quote (rcirc-nick |
| @@ -2454,7 +2452,7 @@ If ARG is given, opens the URL in a new browser window." | |||
| 2454 | 'rcirc-nick-in-message-full-line) | 2452 | 'rcirc-nick-in-message-full-line) |
| 2455 | (rcirc-record-activity (current-buffer) 'nick))))) | 2453 | (rcirc-record-activity (current-buffer) 'nick))))) |
| 2456 | 2454 | ||
| 2457 | (defun rcirc-markup-urls (sender response) | 2455 | (defun rcirc-markup-urls (_sender _response) |
| 2458 | (while (and rcirc-url-regexp ;; nil means disable URL catching | 2456 | (while (and rcirc-url-regexp ;; nil means disable URL catching |
| 2459 | (re-search-forward rcirc-url-regexp nil t)) | 2457 | (re-search-forward rcirc-url-regexp nil t)) |
| 2460 | (let* ((start (match-beginning 0)) | 2458 | (let* ((start (match-beginning 0)) |
| @@ -2485,7 +2483,7 @@ If ARG is given, opens the URL in a new browser window." | |||
| 2485 | (rcirc-add-face (match-beginning 0) (match-end 0) 'rcirc-keyword) | 2483 | (rcirc-add-face (match-beginning 0) (match-end 0) 'rcirc-keyword) |
| 2486 | (rcirc-record-activity (current-buffer) 'keyword)))))) | 2484 | (rcirc-record-activity (current-buffer) 'keyword)))))) |
| 2487 | 2485 | ||
| 2488 | (defun rcirc-markup-bright-nicks (sender response) | 2486 | (defun rcirc-markup-bright-nicks (_sender response) |
| 2489 | (when (and rcirc-bright-nicks | 2487 | (when (and rcirc-bright-nicks |
| 2490 | (string= response "NAMES")) | 2488 | (string= response "NAMES")) |
| 2491 | (with-syntax-table rcirc-nick-syntax-table | 2489 | (with-syntax-table rcirc-nick-syntax-table |
| @@ -2493,7 +2491,7 @@ If ARG is given, opens the URL in a new browser window." | |||
| 2493 | (rcirc-add-face (match-beginning 0) (match-end 0) | 2491 | (rcirc-add-face (match-beginning 0) (match-end 0) |
| 2494 | 'rcirc-bright-nick))))) | 2492 | 'rcirc-bright-nick))))) |
| 2495 | 2493 | ||
| 2496 | (defun rcirc-markup-fill (sender response) | 2494 | (defun rcirc-markup-fill (_sender response) |
| 2497 | (when (not (string= response "372")) ; /motd | 2495 | (when (not (string= response "372")) ; /motd |
| 2498 | (let ((fill-prefix | 2496 | (let ((fill-prefix |
| 2499 | (or rcirc-fill-prefix | 2497 | (or rcirc-fill-prefix |
| @@ -2574,7 +2572,7 @@ If ARG is given, opens the URL in a new browser window." | |||
| 2574 | sender))) | 2572 | sender))) |
| 2575 | message t)))) | 2573 | message t)))) |
| 2576 | 2574 | ||
| 2577 | (defun rcirc-check-auth-status (process sender args text) | 2575 | (defun rcirc-check-auth-status (process sender args _text) |
| 2578 | "Check if the user just authenticated. | 2576 | "Check if the user just authenticated. |
| 2579 | If authenticated, runs `rcirc-authenticated-hook' with PROCESS as | 2577 | If authenticated, runs `rcirc-authenticated-hook' with PROCESS as |
| 2580 | the only argument." | 2578 | the only argument." |
| @@ -2602,10 +2600,10 @@ the only argument." | |||
| 2602 | (run-hook-with-args 'rcirc-authenticated-hook process) | 2600 | (run-hook-with-args 'rcirc-authenticated-hook process) |
| 2603 | (remove-hook 'rcirc-authenticated-hook 'rcirc-join-channels-post-auth t)))))) | 2601 | (remove-hook 'rcirc-authenticated-hook 'rcirc-join-channels-post-auth t)))))) |
| 2604 | 2602 | ||
| 2605 | (defun rcirc-handler-WALLOPS (process sender args text) | 2603 | (defun rcirc-handler-WALLOPS (process sender args _text) |
| 2606 | (rcirc-print process sender "WALLOPS" sender (car args) t)) | 2604 | (rcirc-print process sender "WALLOPS" sender (car args) t)) |
| 2607 | 2605 | ||
| 2608 | (defun rcirc-handler-JOIN (process sender args text) | 2606 | (defun rcirc-handler-JOIN (process sender args _text) |
| 2609 | (let ((channel (car args))) | 2607 | (let ((channel (car args))) |
| 2610 | (with-current-buffer (rcirc-get-buffer-create process channel) | 2608 | (with-current-buffer (rcirc-get-buffer-create process channel) |
| 2611 | ;; when recently rejoining, restore the linestamp | 2609 | ;; when recently rejoining, restore the linestamp |
| @@ -2626,7 +2624,7 @@ the only argument." | |||
| 2626 | (rcirc-print process sender "JOIN" sender channel)))) | 2624 | (rcirc-print process sender "JOIN" sender channel)))) |
| 2627 | 2625 | ||
| 2628 | ;; PART and KICK are handled the same way | 2626 | ;; PART and KICK are handled the same way |
| 2629 | (defun rcirc-handler-PART-or-KICK (process response channel sender nick args) | 2627 | (defun rcirc-handler-PART-or-KICK (process _response channel _sender nick _args) |
| 2630 | (rcirc-ignore-update-automatic nick) | 2628 | (rcirc-ignore-update-automatic nick) |
| 2631 | (if (not (string= nick (rcirc-nick process))) | 2629 | (if (not (string= nick (rcirc-nick process))) |
| 2632 | ;; this is someone else leaving | 2630 | ;; this is someone else leaving |
| @@ -2643,7 +2641,7 @@ the only argument." | |||
| 2643 | (when buffer | 2641 | (when buffer |
| 2644 | (rcirc-disconnect-buffer buffer))))) | 2642 | (rcirc-disconnect-buffer buffer))))) |
| 2645 | 2643 | ||
| 2646 | (defun rcirc-handler-PART (process sender args text) | 2644 | (defun rcirc-handler-PART (process sender args _text) |
| 2647 | (let* ((channel (car args)) | 2645 | (let* ((channel (car args)) |
| 2648 | (reason (cadr args)) | 2646 | (reason (cadr args)) |
| 2649 | (message (concat channel " " reason))) | 2647 | (message (concat channel " " reason))) |
| @@ -2654,10 +2652,10 @@ the only argument." | |||
| 2654 | 2652 | ||
| 2655 | (rcirc-handler-PART-or-KICK process "PART" channel sender sender reason))) | 2653 | (rcirc-handler-PART-or-KICK process "PART" channel sender sender reason))) |
| 2656 | 2654 | ||
| 2657 | (defun rcirc-handler-KICK (process sender args text) | 2655 | (defun rcirc-handler-KICK (process sender args _text) |
| 2658 | (let* ((channel (car args)) | 2656 | (let* ((channel (car args)) |
| 2659 | (nick (cadr args)) | 2657 | (nick (cadr args)) |
| 2660 | (reason (caddr args)) | 2658 | (reason (cl-caddr args)) |
| 2661 | (message (concat nick " " channel " " reason))) | 2659 | (message (concat nick " " channel " " reason))) |
| 2662 | (rcirc-print process sender "KICK" channel message t) | 2660 | (rcirc-print process sender "KICK" channel message t) |
| 2663 | ;; print in private chat buffer if it exists | 2661 | ;; print in private chat buffer if it exists |
| @@ -2682,7 +2680,7 @@ the only argument." | |||
| 2682 | (cons (cons nick line) | 2680 | (cons (cons nick line) |
| 2683 | rcirc-recent-quit-alist)))))))))) | 2681 | rcirc-recent-quit-alist)))))))))) |
| 2684 | 2682 | ||
| 2685 | (defun rcirc-handler-QUIT (process sender args text) | 2683 | (defun rcirc-handler-QUIT (process sender args _text) |
| 2686 | (rcirc-ignore-update-automatic sender) | 2684 | (rcirc-ignore-update-automatic sender) |
| 2687 | (mapc (lambda (channel) | 2685 | (mapc (lambda (channel) |
| 2688 | ;; broadcast quit message each channel | 2686 | ;; broadcast quit message each channel |
| @@ -2692,7 +2690,7 @@ the only argument." | |||
| 2692 | (rcirc-nick-channels process sender)) | 2690 | (rcirc-nick-channels process sender)) |
| 2693 | (rcirc-nick-remove process sender)) | 2691 | (rcirc-nick-remove process sender)) |
| 2694 | 2692 | ||
| 2695 | (defun rcirc-handler-NICK (process sender args text) | 2693 | (defun rcirc-handler-NICK (process sender args _text) |
| 2696 | (let* ((old-nick sender) | 2694 | (let* ((old-nick sender) |
| 2697 | (new-nick (car args)) | 2695 | (new-nick (car args)) |
| 2698 | (channels (rcirc-nick-channels process old-nick))) | 2696 | (channels (rcirc-nick-channels process old-nick))) |
| @@ -2723,25 +2721,25 @@ the only argument." | |||
| 2723 | ;; reauthenticate | 2721 | ;; reauthenticate |
| 2724 | (when rcirc-auto-authenticate-flag (rcirc-authenticate)))))) | 2722 | (when rcirc-auto-authenticate-flag (rcirc-authenticate)))))) |
| 2725 | 2723 | ||
| 2726 | (defun rcirc-handler-PING (process sender args text) | 2724 | (defun rcirc-handler-PING (process _sender args _text) |
| 2727 | (rcirc-send-string process (concat "PONG :" (car args)))) | 2725 | (rcirc-send-string process (concat "PONG :" (car args)))) |
| 2728 | 2726 | ||
| 2729 | (defun rcirc-handler-PONG (process sender args text) | 2727 | (defun rcirc-handler-PONG (_process _sender _args _text) |
| 2730 | ;; do nothing | 2728 | ;; do nothing |
| 2731 | ) | 2729 | ) |
| 2732 | 2730 | ||
| 2733 | (defun rcirc-handler-TOPIC (process sender args text) | 2731 | (defun rcirc-handler-TOPIC (process sender args _text) |
| 2734 | (let ((topic (cadr args))) | 2732 | (let ((topic (cadr args))) |
| 2735 | (rcirc-print process sender "TOPIC" (car args) topic) | 2733 | (rcirc-print process sender "TOPIC" (car args) topic) |
| 2736 | (with-current-buffer (rcirc-get-buffer process (car args)) | 2734 | (with-current-buffer (rcirc-get-buffer process (car args)) |
| 2737 | (setq rcirc-topic topic)))) | 2735 | (setq rcirc-topic topic)))) |
| 2738 | 2736 | ||
| 2739 | (defvar rcirc-nick-away-alist nil) | 2737 | (defvar rcirc-nick-away-alist nil) |
| 2740 | (defun rcirc-handler-301 (process sender args text) | 2738 | (defun rcirc-handler-301 (process _sender args text) |
| 2741 | "RPL_AWAY" | 2739 | "RPL_AWAY" |
| 2742 | (let* ((nick (cadr args)) | 2740 | (let* ((nick (cadr args)) |
| 2743 | (rec (assoc-string nick rcirc-nick-away-alist)) | 2741 | (rec (assoc-string nick rcirc-nick-away-alist)) |
| 2744 | (away-message (caddr args))) | 2742 | (away-message (cl-caddr args))) |
| 2745 | (when (or (not rec) | 2743 | (when (or (not rec) |
| 2746 | (not (string= (cdr rec) away-message))) | 2744 | (not (string= (cdr rec) away-message))) |
| 2747 | ;; away message has changed | 2745 | ;; away message has changed |
| @@ -2751,7 +2749,7 @@ the only argument." | |||
| 2751 | (setq rcirc-nick-away-alist (cons (cons nick away-message) | 2749 | (setq rcirc-nick-away-alist (cons (cons nick away-message) |
| 2752 | rcirc-nick-away-alist)))))) | 2750 | rcirc-nick-away-alist)))))) |
| 2753 | 2751 | ||
| 2754 | (defun rcirc-handler-317 (process sender args text) | 2752 | (defun rcirc-handler-317 (process sender args _text) |
| 2755 | "RPL_WHOISIDLE" | 2753 | "RPL_WHOISIDLE" |
| 2756 | (let* ((nick (nth 1 args)) | 2754 | (let* ((nick (nth 1 args)) |
| 2757 | (idle-secs (string-to-number (nth 2 args))) | 2755 | (idle-secs (string-to-number (nth 2 args))) |
| @@ -2765,31 +2763,31 @@ the only argument." | |||
| 2765 | nick idle-string signon-string))) | 2763 | nick idle-string signon-string))) |
| 2766 | (rcirc-print process sender "317" nil message t))) | 2764 | (rcirc-print process sender "317" nil message t))) |
| 2767 | 2765 | ||
| 2768 | (defun rcirc-handler-332 (process sender args text) | 2766 | (defun rcirc-handler-332 (process _sender args _text) |
| 2769 | "RPL_TOPIC" | 2767 | "RPL_TOPIC" |
| 2770 | (let ((buffer (or (rcirc-get-buffer process (cadr args)) | 2768 | (let ((buffer (or (rcirc-get-buffer process (cadr args)) |
| 2771 | (rcirc-get-temp-buffer-create process (cadr args))))) | 2769 | (rcirc-get-temp-buffer-create process (cadr args))))) |
| 2772 | (with-current-buffer buffer | 2770 | (with-current-buffer buffer |
| 2773 | (setq rcirc-topic (caddr args))))) | 2771 | (setq rcirc-topic (cl-caddr args))))) |
| 2774 | 2772 | ||
| 2775 | (defun rcirc-handler-333 (process sender args text) | 2773 | (defun rcirc-handler-333 (process sender args _text) |
| 2776 | "333 says who set the topic and when. | 2774 | "333 says who set the topic and when. |
| 2777 | Not in rfc1459.txt" | 2775 | Not in rfc1459.txt" |
| 2778 | (let ((buffer (or (rcirc-get-buffer process (cadr args)) | 2776 | (let ((buffer (or (rcirc-get-buffer process (cadr args)) |
| 2779 | (rcirc-get-temp-buffer-create process (cadr args))))) | 2777 | (rcirc-get-temp-buffer-create process (cadr args))))) |
| 2780 | (with-current-buffer buffer | 2778 | (with-current-buffer buffer |
| 2781 | (let ((setter (caddr args)) | 2779 | (let ((setter (cl-caddr args)) |
| 2782 | (time (current-time-string | 2780 | (time (current-time-string |
| 2783 | (seconds-to-time | 2781 | (seconds-to-time |
| 2784 | (string-to-number (cadddr args)))))) | 2782 | (string-to-number (cl-cadddr args)))))) |
| 2785 | (rcirc-print process sender "TOPIC" (cadr args) | 2783 | (rcirc-print process sender "TOPIC" (cadr args) |
| 2786 | (format "%s (%s on %s)" rcirc-topic setter time)))))) | 2784 | (format "%s (%s on %s)" rcirc-topic setter time)))))) |
| 2787 | 2785 | ||
| 2788 | (defun rcirc-handler-477 (process sender args text) | 2786 | (defun rcirc-handler-477 (process sender args _text) |
| 2789 | "ERR_NOCHANMODES" | 2787 | "ERR_NOCHANMODES" |
| 2790 | (rcirc-print process sender "477" (cadr args) (caddr args))) | 2788 | (rcirc-print process sender "477" (cadr args) (cl-caddr args))) |
| 2791 | 2789 | ||
| 2792 | (defun rcirc-handler-MODE (process sender args text) | 2790 | (defun rcirc-handler-MODE (process sender args _text) |
| 2793 | (let ((target (car args)) | 2791 | (let ((target (car args)) |
| 2794 | (msg (mapconcat 'identity (cdr args) " "))) | 2792 | (msg (mapconcat 'identity (cdr args) " "))) |
| 2795 | (rcirc-print process sender "MODE" | 2793 | (rcirc-print process sender "MODE" |
| @@ -2809,7 +2807,7 @@ Not in rfc1459.txt" | |||
| 2809 | (let ((tmpnam (concat " " (downcase channel) "TMP" (process-name process)))) | 2807 | (let ((tmpnam (concat " " (downcase channel) "TMP" (process-name process)))) |
| 2810 | (get-buffer-create tmpnam))) | 2808 | (get-buffer-create tmpnam))) |
| 2811 | 2809 | ||
| 2812 | (defun rcirc-handler-353 (process sender args text) | 2810 | (defun rcirc-handler-353 (process _sender args _text) |
| 2813 | "RPL_NAMREPLY" | 2811 | "RPL_NAMREPLY" |
| 2814 | (let ((channel (nth 2 args)) | 2812 | (let ((channel (nth 2 args)) |
| 2815 | (names (or (nth 3 args) ""))) | 2813 | (names (or (nth 3 args) ""))) |
| @@ -2822,7 +2820,7 @@ Not in rfc1459.txt" | |||
| 2822 | (goto-char (point-max)) | 2820 | (goto-char (point-max)) |
| 2823 | (insert (car (last args)) " ")))) | 2821 | (insert (car (last args)) " ")))) |
| 2824 | 2822 | ||
| 2825 | (defun rcirc-handler-366 (process sender args text) | 2823 | (defun rcirc-handler-366 (process sender args _text) |
| 2826 | "RPL_ENDOFNAMES" | 2824 | "RPL_ENDOFNAMES" |
| 2827 | (let* ((channel (cadr args)) | 2825 | (let* ((channel (cadr args)) |
| 2828 | (buffer (rcirc-get-temp-buffer-create process channel))) | 2826 | (buffer (rcirc-get-temp-buffer-create process channel))) |
| @@ -2847,14 +2845,14 @@ Passwords are stored in `rcirc-authinfo' (which see)." | |||
| 2847 | (dolist (i rcirc-authinfo) | 2845 | (dolist (i rcirc-authinfo) |
| 2848 | (let ((process (rcirc-buffer-process)) | 2846 | (let ((process (rcirc-buffer-process)) |
| 2849 | (server (car i)) | 2847 | (server (car i)) |
| 2850 | (nick (caddr i)) | 2848 | (nick (cl-caddr i)) |
| 2851 | (method (cadr i)) | 2849 | (method (cadr i)) |
| 2852 | (args (cdddr i))) | 2850 | (args (cl-cdddr i))) |
| 2853 | (when (and (string-match server rcirc-server)) | 2851 | (when (and (string-match server rcirc-server)) |
| 2854 | (if (and (memq method '(nickserv chanserv bitlbee)) | 2852 | (if (and (memq method '(nickserv chanserv bitlbee)) |
| 2855 | (string-match nick rcirc-nick)) | 2853 | (string-match nick rcirc-nick)) |
| 2856 | ;; the following methods rely on the user's nickname. | 2854 | ;; the following methods rely on the user's nickname. |
| 2857 | (case method | 2855 | (cl-case method |
| 2858 | (nickserv | 2856 | (nickserv |
| 2859 | (rcirc-send-privmsg | 2857 | (rcirc-send-privmsg |
| 2860 | process | 2858 | process |
| @@ -2878,10 +2876,10 @@ Passwords are stored in `rcirc-authinfo' (which see)." | |||
| 2878 | "Q@CServe.quakenet.org" | 2876 | "Q@CServe.quakenet.org" |
| 2879 | (format "AUTH %s %s" nick (car args)))))))))) | 2877 | (format "AUTH %s %s" nick (car args)))))))))) |
| 2880 | 2878 | ||
| 2881 | (defun rcirc-handler-INVITE (process sender args text) | 2879 | (defun rcirc-handler-INVITE (process sender args _text) |
| 2882 | (rcirc-print process sender "INVITE" nil (mapconcat 'identity args " ") t)) | 2880 | (rcirc-print process sender "INVITE" nil (mapconcat 'identity args " ") t)) |
| 2883 | 2881 | ||
| 2884 | (defun rcirc-handler-ERROR (process sender args text) | 2882 | (defun rcirc-handler-ERROR (process sender args _text) |
| 2885 | (rcirc-print process sender "ERROR" nil (mapconcat 'identity args " "))) | 2883 | (rcirc-print process sender "ERROR" nil (mapconcat 'identity args " "))) |
| 2886 | 2884 | ||
| 2887 | (defun rcirc-handler-CTCP (process target sender text) | 2885 | (defun rcirc-handler-CTCP (process target sender text) |
| @@ -2899,7 +2897,7 @@ Passwords are stored in `rcirc-authinfo' (which see)." | |||
| 2899 | (rcirc-print process sender "CTCP" target | 2897 | (rcirc-print process sender "CTCP" target |
| 2900 | (format "%s" text) t)))))) | 2898 | (format "%s" text) t)))))) |
| 2901 | 2899 | ||
| 2902 | (defun rcirc-handler-ctcp-VERSION (process target sender args) | 2900 | (defun rcirc-handler-ctcp-VERSION (process _target sender _args) |
| 2903 | (rcirc-send-string process | 2901 | (rcirc-send-string process |
| 2904 | (concat "NOTICE " sender | 2902 | (concat "NOTICE " sender |
| 2905 | " :\C-aVERSION " rcirc-id-string | 2903 | " :\C-aVERSION " rcirc-id-string |
| @@ -2908,12 +2906,12 @@ Passwords are stored in `rcirc-authinfo' (which see)." | |||
| 2908 | (defun rcirc-handler-ctcp-ACTION (process target sender args) | 2906 | (defun rcirc-handler-ctcp-ACTION (process target sender args) |
| 2909 | (rcirc-print process sender "ACTION" target args t)) | 2907 | (rcirc-print process sender "ACTION" target args t)) |
| 2910 | 2908 | ||
| 2911 | (defun rcirc-handler-ctcp-TIME (process target sender args) | 2909 | (defun rcirc-handler-ctcp-TIME (process _target sender _args) |
| 2912 | (rcirc-send-string process | 2910 | (rcirc-send-string process |
| 2913 | (concat "NOTICE " sender | 2911 | (concat "NOTICE " sender |
| 2914 | " :\C-aTIME " (current-time-string) "\C-a"))) | 2912 | " :\C-aTIME " (current-time-string) "\C-a"))) |
| 2915 | 2913 | ||
| 2916 | (defun rcirc-handler-CTCP-response (process target sender message) | 2914 | (defun rcirc-handler-CTCP-response (process _target sender message) |
| 2917 | (rcirc-print process sender "CTCP" nil message t)) | 2915 | (rcirc-print process sender "CTCP" nil message t)) |
| 2918 | 2916 | ||
| 2919 | (defgroup rcirc-faces nil | 2917 | (defgroup rcirc-faces nil |