;;; erc-backend.el --- Backend network communication for ERC
-;; Copyright (C) 2004-2014 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2015 Free Software Foundation, Inc.
;; Filename: erc-backend.el
;; Author: Lawrence Mitchell <wence@gmx.li>
(run-at-time erc-server-reconnect-timeout nil
#'erc-process-sentinel-2
event buffer)
- (error (concat "`erc-server-reconnect-timeout`"
+ (error (concat "`erc-server-reconnect-timeout'"
" must be a number")))))))))))
(defun erc-process-sentinel-1 (event buffer)
Would expand to:
(prog2
- (defvar erc-server-311-functions 'erc-server-311
+ (defvar erc-server-311-functions \\='erc-server-311
\"Some non-generic variable documentation.
Hook called upon receiving a 311 server response.
aliases))
(let* ((hook-name (intern (format "erc-server-%s-functions" name)))
(fn-name (intern (format "erc-server-%s" name)))
- (hook-doc (format "%sHook called upon receiving a %%s server response.
+ (hook-doc (format-message "\
+%sHook called upon receiving a %%s server response.
Each function is called with two arguments, the process associated
with the response and the parsed response. If the function returns
non-nil, stop processing the hook. Otherwise, continue.
(concat extra-var-doc "\n\n")
"")
fn-name))
- (fn-doc (format "%sHandler for a %s server response.
+ (fn-doc (format-message "\
+%sHandler for a %s server response.
PROC is the server process which returned the response.
PARSED is the actual response as an `erc-response' struct.
If you want to add responses don't modify this function, but rather
(cl-loop for alias in aliases
collect (intern (format "erc-server-%s-functions" alias)))))
`(prog2
- ;; Normal hook variable.
- (defvar ,hook-name ',fn-name ,(format hook-doc name))
+ ;; Normal hook variable. The variable may already have a
+ ;; value at this point, so I default to nil, and (add-hook)
+ ;; unconditionally
+ (defvar ,hook-name nil ,(format hook-doc name))
+ (add-to-list ',hook-name ',fn-name)
;; Handler function
(defun ,fn-name (proc parsed)
,fn-doc
"The channel topic has changed." nil
(let* ((ch (car (erc-response.command-args parsed)))
(topic (erc-trim-string (erc-response.contents parsed)))
- (time (format-time-string erc-server-timestamp-format
- (current-time))))
+ (time (format-time-string erc-server-timestamp-format)))
(pcase-let ((`(,nick ,login ,host)
(erc-parse-user (erc-response.sender parsed))))
(erc-update-channel-member ch nick nick nil nil nil nil nil nil host login)