Commit 83dc6995 authored by Miles Bader's avatar Miles Bader
Browse files

Merge from erc--emacs--22

Merge from my ERC Emacs 22 integration branch.  The version is now "5.2
stable pre-release".  This will probably be the last change to the
version of ERC in Emacs 22 before the release, pending any bugfixes.  For
details on the changes, see the lisp/erc/ChangeLog file.

Note that ERC is now invoked with M-x erc, not M-x erc-select.  If you
were using the old `erc' function programmatically, use `erc-open'

Creator:  Michael Olson <>
parent e15a0495
2006-11-20 Michael Olson <>
* NEWS: Change M-x erc-select to M-x erc.
2006-11-20 Sun Yijiang <>
* Updated.
......@@ -92,6 +96,11 @@
* PROBLEMS (are): Emacs compiled with Gtk+ crashes when closing a
display (x-close-connection).
2006-09-03 Diane Murray <>
* erc.texi (Getting Started, Connecting): Changed erc-select to
2006-09-02 Juri Linkov <>
* HELLO: Regroup Europe Non-ASCII examples by similar scripts.
ERC NEWS -*- outline -*-
* Changes in ERC 5.2 (stable pre-release for Emacs 22)
** M-x erc RET now starts ERC.
`erc-select' has been changed to `erc'. `erc-select' still remains as
an alias of `erc'. Likewise, `erc-select-ssl' has been renamed to
`erc-ssl' with `erc-select-ssl' as its alias. The function that was
known as `erc' is now `erc-open'.
** Changes and additions to modules
*** Channel tracking (erc-track.el)
**** Use mouse-face and help-echo for channel names in the mode-line.
This helps people using a mouse know that they are buttons and can be
clicked on.
* Changes in ERC 5.1.4
** Make find-function and find-variable work in Emacs 22 for
......@@ -1690,8 +1690,8 @@ ERC is a powerful, modular, and extensible IRC client for Emacs.
To see what modules are available, type
M-x customize-option erc-modules RET.
To start an IRC session, type M-x erc-select, and follow the prompts
for server, port, and nick.
To start an IRC session, type M-x erc, and follow the prompts for
server, port, and nick.
** Rcirc is now part of the Emacs distribution.
2006-11-20 Michael Olson <>
* erc.el (erc-version-string): Call this Version 5.2 stable
pre-release, since it diverges slightly from our 5.2 branch, in
that unstable features are not included.
(erc-update-modules): Display better error message when module not
2006-11-12 Michael Olson <>
* erc-log.el: Save all log buffers when Emacs exits, in case
someone ignores the warning about open processes. Remove the
advice code in the commentary.
(erc-save-query-buffers): Docfix.
(erc-log-save-all-buffers): New function that saves all ERC
buffers to logs.
(erc-current-logfile): Fix bug in filename selection, where the
current buffer was erroneously being preferred over the given
2006-11-08 Michael Olson <>
* erc.el (erc-string-to-port): Avoid error when a numerical port
is passed. Thanks to Zekeriya KOÇ for the report.
2006-11-08 Łukasz Demianiuk <> (tiny change)
* erc.el (erc-header-line): Fix typo.
......@@ -10,11 +35,168 @@
* erc-autoaway.el (erc-autoaway-reestablish-idletimer):
* erc-truncate.el (truncate): Fix typo in docstring.
2006-10-21 Michael Olson <>
* erc.el (erc-iswitchb): Fix bug when hitting C-c C-b without
first loading iswitchb. Thanks to Leo for the report.
2006-10-10 Michael Olson <>
* erc.el (erc-default-port): Make the default be 6667 instead of
ircd. since Mac OS X apparently has problems with looking up that
port name.
* erc-backend.el (353): Receive names after displaying the initial
message, instead of before.
2006-10-05 Diane Murray <>
* erc.el (erc-my-nick-face): New face.
(erc): Use FULL-NAME argument, not `erc-user-full-name'. This
fixes a bug where the :full-name argument passed to the function
was not respected.
(erc-format-my-nick): Use `erc-my-nick-face'. This should help
make it easier to find messages you sent in conversations when
`erc-show-my-nick' is non-nil.
(erc-compute-server): Doc fix.
2006-09-11 Michael Olson <>
* erc-nicklist.el (erc-nicklist-insert-contents): Add missing
parenthesis. Thanks to Stephan Stahl for the report.
2006-09-10 Eric Hanchrow <>
* erc.el (erc-cmd-IGNORE): Prompt user if this might be a regexp
instead of a single user.
2006-09-10 Michael Olson <>
* erc.el (erc-generate-new-buffer-name): If this is a server
buffer and a process exists already, create a new buffer.
(erc-open): If the IRC session was continued, restore the old
point. Thanks to Stephan Stahl for the report.
(erc-member-ignore-case): Coding style tweak.
(erc-cmd-UNIGNORE): Quote the user before comparison. If we don't
find the user listed verbatim, try to match them against the list
using string-match. In this case, prompt as to whether the regexp
should be removed.
(erc-ignored-user-p): Remove CL-ism.
* erc-autoaway.el (erc-autoaway-possibly-set-away): Check to see
whether we are already away.
* erc-menu.el: Fix potential compiler warning.
2006-09-07 Diane Murray <>
* erc.el: Updated Commentary and URL.
(erc-iswitchb, erc-display-line, erc-set-modes, erc-update-modes)
(erc-arrange-session-in-multiple-windows): No need to check if
`erc-server-process' is bound.
(erc-server-buffer-live-p): Doc fix.
(erc-part-from-channel): Don't use any initial contents at prompt.
(erc-format-nick, erc-format-@nick): Doc fix. Use `when'.
(s367): Fixed to support only banmask and channel which is the
standard. Also, there's no reason to add a message to each banned
user entry trying to persuade the user to use /banlist instead of
/mode #channel +b. That part of the message was a little
confusing, anyways.
(s367-set-by): New catalog entry. The user who set the ban and
the time of ban seem to be specific to only certain servers such
as freenode.
* erc-autoaway.el (erc-autoaway-idletimer): Doc fix.
* erc-backend.el (erc-server-process-alive): No need to check if
`erc-server-process' is bound.
(367): Use s367 or s367-set-by where appropriate.
* erc-compat.el: Fixed URL.
* erc-dcc.el: Updated copyright years. Added Usage section.
Changed supported Emacs version number from 21.3.50 to 22 in
* erc-ibuffer.el (erc-server-name, erc-target, erc-away): No need
to check if `erc-server-process' is bound.
* erc-nicklist.el: Added to the Commentary section an explanation
that `erc-nicklist-quit' should be called from within the nicklist
buffer. Set file coding to utf-8 so a contributor's name is
displayed correctly.
(erc-nicklist-icons-directory): Use customize type directory
instead of string.
(erc-nicklist-insert-contents): Set bbdb-nick to an empty string
if it wasn't found. This fixes a bug where an error would occur
when using `string=' on bbdb-nick if it was nil.
* erc-replace.el: Removed URL from file information since it
doesn't exist.
* erc-sound.el: Updated copyright years. Fixed Commentary and
added Usage section.
(define-erc-module): Add and remove `erc-ctcp-query-SOUND' to
`erc-ctcp-query-SOUND-hook' here. Removed the keybinding
(erc-play-sound, erc-default-sound, erc-cmd-SOUND)
(erc-ctcp-query-SOUND): Doc fix.
(erc-play-command): Removed, not necessary anymore.
(erc-ctcp-query-SOUND-hook): Set to nil as default. Moved up
higher in code, added docstring.
(erc-play-sound): Use `play-sound-file'. It exists in GNU Emacs
as well since version 21 or earlier. Removed commented-out older
version of function.
* NEWS: Fixed formatting, added channel tracking change.
2006-09-03 Diane Murray <>
* erc.el: M-x erc RET can now be used to start ERC.
(erc-open): Renamed from `erc'.
(erc-before-connect): Change erc-select to erc.
(erc): Renamed from `erc-select'. Use `erc-open'.
(erc-select): Defined as alias of `erc'.
(erc-ssl): Renamed from `erc-select-ssl'. Use `erc'.
(erc-select-ssl): Defined as alias of `erc-ssl'.
(erc-cmd-SERVER): Use `erc'.
(erc-query, erc-handle-irc-url): Use `erc-open'.
* erc-backend.el (erc-process-sentinel-1, JOIN): Use `erc-open'.
* erc-menu.el (erc-menu-definition): Use `erc'.
* erc-networks.el: Updated copyright years.
(erc-server-select): Use keyword arguments when calling `erc'.
* erc.texi (Getting Started, Connecting): Changed erc-select to
* NEWS: Added note about these changes.
2006-08-21 Diane Murray <>
* erc-track.el (erc-track-mode-line-mouse-face): New variable.
(erc-make-mode-line-buffer-name): Add help-echo and mouse-face
properties to channel name.
2006-08-14 Diane Murray <>
* erc-menu.el: Updated copyright years. Removed EmacsWiki URL.
(erc-menu-definition): Name the menu "ERC" instead of "IRC" to
avoid confusion with rcirc and other clients.
2006-08-13 Romain Francoise <>
* erc-match.el (erc-log-matches-make-buffer): End `y-or-n-p'
prompt with a space.
2006-08-11 Michael Olson <>
* erc-fill.el (erc-fill): Skip any initial empty lines so that we
avoid errors when inserting disconnect messages and other messages
that begin with newlines.
2006-08-07 Michael Olson <>
* erc-backend.el (erc-process-sentinel-1): Use erc-display-message
......@@ -32,6 +214,9 @@
2006-08-06 Michael Olson <>
* erc-backend.el (erc-server-send-queue): Update from Circe
version of this function.
* erc.el (erc-arrange-session-in-multiple-windows): Fix bug with
multi-tty Emacs.
(erc-select-startup-file): Fix bug introduced by recent change.
......@@ -38,7 +38,7 @@ yourself back when you type something."
(defvar erc-autoaway-idletimer nil
"The Emacs idletimer.
This is only used when `erc-autoaway-use-emacs-idle' is non-nil.")
This is only used when `erc-autoaway-idle-method' is set to 'emacs.")
;;;###autoload (autoload 'erc-autoaway-mode "erc-autoaway")
(define-erc-module autoaway nil
......@@ -206,6 +206,7 @@ exceeds `erc-autoaway-idle-seconds'."
;; this function is called from `erc-timer-hook', which is called
;; whenever the server sends something to the client.
(when (and erc-auto-set-away
(not erc-autoaway-caused-away)
(not (erc-away-p)))
(let ((idle-time (erc-time-diff erc-autoaway-last-sent-time
......@@ -416,7 +416,7 @@ Currently this is called by `erc-send-input'."
(defun erc-server-process-alive ()
"Return non-nil when `erc-server-process' is open or running."
(and (boundp 'erc-server-process)
(and erc-server-process
(processp erc-server-process)
(memq (process-status erc-server-process) '(run open))))
......@@ -512,8 +512,8 @@ action."
(not (string-match "^failed with code 111" event)))
;; Yuck, this should perhaps funcall
;; erc-server-reconnect-function with no args
(erc erc-session-server erc-session-port erc-server-current-nick
erc-session-user-full-name t erc-session-password)
(erc-open erc-session-server erc-session-port erc-server-current-nick
erc-session-user-full-name t erc-session-password)
;; terminate, do not reconnect
(erc-display-message nil 'error (current-buffer)
'terminated ?e event))))
......@@ -673,7 +673,8 @@ protection algorithm."
(error nil)))))
(when erc-server-flood-queue
(setq erc-server-flood-timer
(run-at-time 2 nil #'erc-server-send-queue buffer))))))
(run-at-time (+ 0.2 erc-server-flood-penalty)
nil #'erc-server-send-queue buffer))))))
(defun erc-message (message-command line &optional force)
"Send LINE to the server as a privmsg or a notice.
......@@ -1038,11 +1039,11 @@ add things to `%s' instead."
(let* ((str (cond
;; If I have joined a channel
((erc-current-nick-p nick)
(setq buffer (erc erc-session-server erc-session-port
nick erc-session-user-full-name
nil nil
erc-default-recipients chnl
(setq buffer (erc-open erc-session-server erc-session-port
nick erc-session-user-full-name
nil nil
erc-default-recipients chnl
(when buffer
(set-buffer buffer)
(erc-add-default-channel chnl)
......@@ -1583,11 +1584,11 @@ See `erc-display-server-message'." nil
"NAMES notice." nil
(let ((channel (third (erc-response.command-args parsed)))
(users (erc-response.contents parsed)))
(erc-with-buffer (channel proc)
(erc-channel-receive-names users))
(erc-display-message parsed 'notice (or (erc-get-buffer channel proc)
's353 ?c channel ?u users)))
's353 ?c channel ?u users)
(erc-with-buffer (channel proc)
(erc-channel-receive-names users))))
(define-erc-response-handler (366)
"End of NAMES." nil
......@@ -1598,11 +1599,16 @@ See `erc-display-server-message'." nil
"Channel ban list entries" nil
(multiple-value-bind (channel banmask setter time)
(cdr (erc-response.command-args parsed))
(erc-display-message parsed 'notice 'active 's367
?c channel
?b banmask
?s setter
?t time)))
;; setter and time are not standard
(if setter
(erc-display-message parsed 'notice 'active 's367-set-by
?c channel
?b banmask
?s setter
?t (or time ""))
(erc-display-message parsed 'notice 'active 's367
?c channel
?b banmask))))
(define-erc-response-handler (368)
"End of channel ban list" nil
......@@ -3,7 +3,7 @@
;; Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
;; Author: Alex Schroeder <>
;; URL:
;; URL:
;; This file is part of GNU Emacs.
......@@ -35,7 +35,9 @@
;; rewritten to support the way how ERC operates. Server socket support
;; was added for DCC CHAT and SEND afterwards. Thanks
;; to the original authors for their work.
;;; Usage:
;; To use this file, put
;; (require 'erc-dcc)
;; in your .emacs.
......@@ -49,7 +51,7 @@
;; /dcc send nick file - Offer DCC SEND to nick
;; Please note that offering DCC connections (offering chats and sending
;; files) is only supported with Emacs 21.3.50 (CVS).
;; files) is only supported with Emacs 22.
;;; Code:
......@@ -122,7 +122,15 @@ characters. Set to nil to disable."
You can put this on `erc-insert-modify-hook' and/or `erc-send-modify-hook'."
(unless (erc-string-invisible-p (buffer-substring (point-min) (point-max)))
(when erc-fill-function
(funcall erc-fill-function))))
;; skip initial empty lines
(goto-char (point-min))
(while (and (looking-at "[ \t\n]*$")
(= (forward-line 1) 0))))
(unless (eobp)
(narrow-to-region (point) (point-max))
(funcall erc-fill-function))))))
(defun erc-fill-static ()
"Fills a text such that messages start at column `erc-fill-static-center'."
......@@ -91,14 +91,14 @@
" "))
(define-ibuffer-column erc-server-name (:name "Server")
(if (and (boundp 'erc-server-process) (processp erc-server-process))
(if (and erc-server-process (processp erc-server-process))
(with-current-buffer (process-buffer erc-server-process)
(or erc-server-announced-name erc-session-server))
(define-ibuffer-column erc-target (:name "Target")
(if (eq major-mode 'erc-mode)
(cond ((and (boundp 'erc-server-process) (processp erc-server-process)
(cond ((and erc-server-process (processp erc-server-process)
(eq (current-buffer) (process-buffer erc-server-process)))
(concat "Server " erc-session-server ":"
(erc-port-to-string erc-session-port)))
......@@ -125,7 +125,7 @@
(define-ibuffer-column erc-away (:name "A")
(if (and (boundp 'erc-server-process)
(if (and erc-server-process
(processp erc-server-process)
(with-current-buffer (process-buffer erc-server-process)
......@@ -43,14 +43,6 @@
;; (require 'erc-log)
;; You may optionally want the following code, to save all ERC buffers
;; without confirmation when exiting emacs:
;; (defadvice save-buffers-kill-emacs (before save-logs (&rest args) activate)
;; (save-some-buffers t (lambda ()
;; (when (and (eq major-mode 'erc-mode)
;; (not (null buffer-file-name))) t))))
;; If you only want to save logs for some buffers, customise the
;; variable `erc-enable-logging'.
......@@ -213,6 +205,7 @@ also be a predicate function. To only log when you are not set away, use:
(add-hook 'erc-send-post-hook 'erc-save-buffer-in-logs))
(add-hook 'erc-kill-buffer-hook 'erc-save-buffer-in-logs)
(add-hook 'erc-kill-channel-hook 'erc-save-buffer-in-logs)
(add-hook 'kill-emacs-hook 'erc-log-save-all-buffers)
(add-hook 'erc-quit-hook 'erc-conditional-save-queries)
(add-hook 'erc-part-hook 'erc-conditional-save-buffer)
;; append, so that 'erc-initialize-log-marker runs first
......@@ -225,6 +218,7 @@ also be a predicate function. To only log when you are not set away, use:
(remove-hook 'erc-send-post-hook 'erc-save-buffer-in-logs)
(remove-hook 'erc-kill-buffer-hook 'erc-save-buffer-in-logs)
(remove-hook 'erc-kill-channel-hook 'erc-save-buffer-in-logs)
(remove-hook 'kill-emacs-hook 'erc-log-save-all-buffers)
(remove-hook 'erc-quit-hook 'erc-conditional-save-queries)
(remove-hook 'erc-part-hook 'erc-conditional-save-buffer)
(remove-hook 'erc-connect-pre-hook 'erc-log-setup-logging)
......@@ -263,7 +257,7 @@ Returns nil iff `erc-server-buffer-p' returns t."
(not (erc-server-buffer-p)))))
(defun erc-save-query-buffers (process)
"Save all buffers process."
"Save all buffers of the given PROCESS."
(erc-with-all-buffers-of-server process
......@@ -278,6 +272,12 @@ Returns nil iff `erc-server-buffer-p' returns t."
(when erc-save-queries-on-quit
(erc-save-query-buffers process)))
;; Make sure that logs get saved, even if someone overrides the active
;; process prompt for a quick exit from Emacs
(defun erc-log-save-all-buffers ()
(dolist (buffer (erc-buffer-list))
(erc-save-buffer-in-logs buffer)))
(defun erc-logging-enabled (&optional buffer)
"Return non-nil if logging is enabled for BUFFER.
......@@ -309,7 +309,7 @@ The result is converted to lowercase, as IRC is case-insensitive"
(funcall erc-generate-log-file-name-function
(or buffer (current-buffer))
(or (erc-default-target) (buffer-name buffer))
(or (buffer-name buffer) (erc-default-target))
erc-session-server erc-session-port))
......@@ -4,7 +4,6 @@
;; Author: Mario Lang <>
;; Keywords: comm, processes, menu
;; URL:
;; This file is part of GNU Emacs.
......@@ -29,11 +28,12 @@
;;; Code:
;(require 'erc)
(require 'easymenu)
(defvar erc-menu-definition
(list "IRC"
["Connect to server..." erc-select t]
(list "ERC"
["Connect to server..." erc t]
["Disconnect from server..." erc-quit-server erc-server-connected]
["List channels..." erc-list-channels
......@@ -809,7 +809,7 @@ As an example:
(erc-ports-list (nth 3 srv))
(list (nth 3 srv))))
(port (nth (random (length ports)) ports)))
(erc host port erc-nick erc-user-full-name t)))
(erc :server host :port port)))
;;; The following experimental
;; It does not work yet, help me with it if you
......@@ -29,7 +29,7 @@
;; This provides a minimal mIRC style nicklist buffer for ERC. To
;; activate, do M-x erc-nicklist RET in the channel buffer you want
;; the nicklist to appear for. To close and quit the nicklist
;; buffer, do M-x erc-nicklist-quit RET.
;; buffer, do M-x erc-nicklist-quit RET from within the nicklist buffer.
;; TODO:
;; o Somehow associate nicklist windows with channel windows so they
......@@ -97,7 +97,7 @@ By \"chat medium\", we mean IRC, AOL, MSN, ICQ, etc."
"*Directory of the PNG files for chat icons.
Icons are displayed if `erc-nicklist-use-icons' is non-nil."
:group 'erc-nicklist
:type 'string)
:type 'directory)
(defcustom erc-nicklist-voiced-position 'bottom
"*Position of voiced nicks in the nicklist.
......@@ -207,7 +207,9 @@ Seach for the BBDB record of this contact. If not found, return nil."
(channels (erc-server-user-buffers server-user))
(op (erc-channel-user-op channel-user))
(voice (erc-channel-user-voice channel-user))
(bbdb-nick (erc-nicklist-search-for-nick (concat login "@" host)))
(bbdb-nick (or (erc-nicklist-search-for-nick
(concat login "@" host))
(away-status (if voice "" "\n(Away)"))
(balloon-text (concat bbdb-nick (if (string= "" bbdb-nick)
"" "\n")
......@@ -406,6 +408,7 @@ list has all the voiced users according to
;; Local Variables:
;; indent-tabs-mode: t
;; tab-width: 8
;; coding: utf-8
;; End:
;; arch-tag: db37a256-87a7-4544-bd90-e5f16c9f5ca5
......@@ -5,7 +5,6 @@
;; Author: Andreas Fuchs <>
;; Maintainer: Mario Lang (
;; Keywords: IRC, client, Internet
;; URL:
;; This file is part of GNU Emacs.
......@@ -21,9 +21,26 @@
;;; Commentary:
;; This used to be in erc.el, I (Jorgen) just extracted it from there
;; and put it in this file. Bugs and features are those of the
;; original author.
;; Play sounds when users send you CTCP SOUND messages.
;; This file also defines the command /sound so that you can send
;; sound requests to other users.
;;; Usage:
;; Add the following to your .emacs if you want to play sounds.
;; (require 'erc-soud)
;; (erc-sound-enable)
;; To send requests to other users from within query buffers, type the
;; following:
;; /sound filename optional-message-text
;; You can also type the following:
;; /ctcp nickname sound filename optional-message
;;; Code:
......@@ -34,9 +51,11 @@
"In ERC sound mode, the client will respond to CTCP SOUND requests
and play sound files as requested."
;; Enable:
((define-key erc-mode-map "\C-c\C-s" 'erc-toggle-sound))
((add-hook 'erc-ctcp-query-SOUND-hook 'erc-ctcp-query-SOUND)
(define-key erc-mode-map "\C-c\C-s" 'erc-toggle-sound))
;; Disable:
((define-key erc-mode-map "\C-c\C-s" 'undefined)))
((remove-hook 'erc-ctcp-query-SOUND-hook 'erc-ctcp-query-SOUND)
(define-key erc-mode-map "\C-c\C-s" 'undefined)))
(erc-define-catalog-entry 'english 'CTCP-SOUND "%n (%u@%h) plays %s:%m")
......@@ -45,7 +64,7 @@ and play sound files as requested."
:group 'erc)
(defcustom erc-play-sound t
"*Play sound on SOUND ctcp requests (used in ICQ chat)."
"*Play sounds when you receive CTCP SOUND requests."
:group 'erc-sound
:type 'boolean)
......@@ -55,18 +74,22 @@ and play sound files as requested."
:type '(repeat directory))
(defcustom erc-default-sound nil
"Play this sound if the requested file was not found."
"Play this sound if the requested file was not found.
If this is set to nil or the file doesn't exist a beep will sound."
:group 'erc-sound
:type '(choice (const nil)
(defcustom erc-play-command "play"
"Command for playing sound samples."
:group 'erc-sound