Release ERC 5.2.

I have updated the version of ERC to 5.2, since it fixes a bug with C-c
C-SPC being bound globally by default.  For the full list of changes in
this version, see etc/ERC-NEWS.

Revision: emacs@sv.gnu.org/emacs--devo--0--patch-687
Creator:  Michael Olson <mwolson@gnu.org>
This commit is contained in:
Miles Bader 2007-04-01 13:36:38 +00:00
parent 25c8c1594f
commit ff59d266c7
28 changed files with 3016 additions and 1787 deletions

View file

@ -1,3 +1,8 @@
2007-04-01 Michael Olson <mwolson@gnu.org>
* ERC-NEWS: Update for the ERC 5.2 release. Most of these entries
were for previously-committed changes.
2007-03-31 Michael Albinus <michael.albinus@gmx.de>
* PROBLEMS: Remove Tramp problem; it has been fixed.

View file

@ -3,8 +3,7 @@ ERC NEWS -*- outline -*-
Copyright (C) 2006, 2007 Free Software Foundation, Inc.
See the end of the file for license conditions.
* Changes in ERC 5.2 (stable pre-release for Emacs 22)
* Changes in ERC 5.2
** M-x erc RET now starts ERC.
`erc-select' has been changed to `erc'. `erc-select' still remains as
@ -12,37 +11,173 @@ 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'.
** Open query buffers by default when private messages are received.
The default value of `erc-auto-query' has been changed to 'bury.
** New command: /RECONNECT
This command tries to reconnect to the current IRC server exactly
once. It does not work in server buffers (throws an error before the
command is run), but works in query and channel buffers.
** In MS-DOS environments, look for _ercrc.el rather than .ercrc.el.
** Fix buggy interaction with multi-tty Emacs.
** After running /QUIT, make sure that the IRC process is killed within
4 seconds. Freenode, in particular, needs this at times.
** If the IRC process has not responded to our PINGs within a certain
time, kill it and restart the connection. See
`erc-server-auto-reconnect', `erc-server-reconnect-attempts',
`erc-server-reconnect-timeout', `erc-server-send-ping-interval', and
`erc-server-send-ping-timeout' to fine-tune ERC's behavior.
** Avoid getting into an infinite connection loop.
Previously, this could happen if your nick was banned, you were using
Tor, incorrect information was entered, or the connection was bad.
** Make ban messages less confusing.
** Restore the point correctly when reconnecting to an IRC server.
** Make /IGNORE and /UNIGNORE prompt to determine whether their
argument is a user or a regexp. This results in less-confusing
behavior when trying to ignore someone who has a bracket in their
nick.
** Make the default port "6667" rather than "ircd", because some
operating systems don't know what port "ircd" maps to.
** Fix several bugs in erc-iswitchb (C-c C-b).
** Clean up internal documentation.
Special thanks go to Juanma Barranquero for the thorough vetting of
ERC's internal documentation.
** Display a more informative message when a module is not found.
** Fix a bug where paths were being colored like IRC commands.
** In the customize interface for `erc-modules', add the name of the module.
This makes it easier to find modules by name.
** erc-server-send-ping-interval: Change to use a default of 30 seconds.
** Some files which are included with the release of ERC 5.2 will not
appear in the version of ERC that is bundled with Emacs 22. These
extras files may be found at:
o http://ftp.gnu.org/gnu/erc/erc-5.2-extras.tar.gz, or
o http://ftp.gnu.org/gnu/erc/erc-5.2-extras.zip.
** Renamed files
Several files were renamed so as to make them distinct to users of the
MS-DOS operating system.
o erc-autojoin.el -> erc-join.el
o erc-complete.el -> erc-hecomplete.el
o erc-nickserv.el -> erc-services.el
o ChangeLog.NNNN -> ChangeLog.NN
** Header line changes
*** Remove "[IRC]" from the header line.
*** Add the %l format character to `erc-header-line-format',
*** Document how to remove the header line.
Namely: (setq erc-header-line-format nil).
** New options
*** erc-server-reconnect-attempts: Determines the number of
reconnection attempts that ERC will make per server.
*** erc-server-reconnect-timeout: New option that determines the
amount of time, in seconds, that ERC will wait between successive
reconnect attempts.
*** erc-server-reconnect-timeout: Determines the amount of time,
in seconds, that ERC will wait between successive reconnect attempts.
*** erc-server-send-ping-timeout: Determines when to consider a connection
stalled and restart it. The default is after 120 seconds.
*** erc-system-name: Determines the system name to use when logging in.
The default is to figure this out by calling `system-name'.
** New face: `erc-my-nick-face'
This helps make it easier to distinguish messages sent by yourself
from messages sent by other users when the value of the variable
`erc-show-my-nick' is non-nil.
** Namespace changes
*** New macro: `erc-with-server-buffer'
Switches to the current ERC server buffer and runs some code. If no
server buffer is available, return nil. This is a useful way to
access variables in the server buffer.
*** New function: `erc-open-server-buffer-p'
Returns non-nil if the given buffer is an ERC server buffer that has
an open IRC process.
*** New function: `erc-format-lag-time'
Returns the estimated lag time to server, `erc-server-lag'.
*** Renamed items
o `erc-server-setup-periodical-server-ping' is now
`erc-server-setup-periodical-ping'
o `erc-away-p' is now `erc-away-time'
** Changes to the ERC manual
*** New section: Sample Session.
Describes a sample ERC session for connecting to the #emacs channel on
Freenode. Also mention the #erc channel.
*** New section: Special Features.
Describes some of the special features of ERC.
*** Getting Started: Mention ~/.emacs.d/.ercrc.el and the Customize
interface.
*** Development: Mention ErcDevelopment page on emacswiki.org.
*** Tips and Tricks: Remove empty section for now.
*** Options: Mention how to see available ERC options.
*** Sample Configuration: Add an example of how to configure ERC.
** New modules
*** Autoaway (erc-autoaway.el)
**** Make this much more reliable.
**** Avoid duplicate messages when coming back from being away.
**** Fix bug where autoaway was enabled just by loading the file.
*** BBDB (erc-bbdb.el)
**** Display information on how to cancel merging of info or how to
create a new John Doe record.
**** Make it so that information from /whois continues to come in, even
while prompting for a record to merge.
**** Make hitting C-g correctly abort merging the record.
*** Capab identify (erc-capab.el)
Mark users who haven't identified to NickServ on servers supporting
CAPAB IDENTIFY-MSG.
** Changes and additions to modules
*** Channel lists (erc-list.el)
*** Button (erc-button.el)
**** This has been removed from Emacs 22, since a major contributor
to it has not yet assigned changes.
**** Make <backtab> go to the previous button.
*** Channel tracking (erc-track.el)
@ -50,6 +185,103 @@ to it has not yet assigned changes.
This helps people using a mouse know that they are buttons and can be
clicked on.
**** Fix issue where C-c C-SPC could conflict with user-defined keybindings.
This is accomplished by moving these bindings to their own global
minor mode. Now the default is to check whether the user has bound
something to C-c C-SPC or C-c C-@. If they have, prompt them about
whether to really override that binding. This also has the effect of
preventing ERC from clobbering rcirc's keybinding, unless this is
desired. See `erc-track-enable-keybindings' for more details.
**** New option: erc-track-enable-keybindings.
Determine whether or not to enable the C-c C-SPC and C-c C-@
keybindings. The default is to ask whether to do this if a binding to
these keys already exists. It can also be set to t or nil to always
bind or never bind, respectively.
**** Remove `track-when-inactive' module.
See `erc-track-when-inactive' for further details.
**** New option: erc-track-when-inactive.
This option replaces the track-when-inactive module. Set it to
non-nil to track activity even in visible buffers when inactive. The
default is nil.
**** Remove the `track-modified-channels' alias for the `track' module.
*** DCC support (erc-dcc.el)
**** Add Usage section to Commentary.
**** Fix a bug in the server message output.
*** Filling (erc-fill.el)
**** Fix bug involving messages that start with one or more blank lines.
*** Identd (erc-identd.el)
**** New option `erc-identd-port'
Specifies the port to use if none is given as an argument to
`erc-identd-start'. This is placed in the new customization group
`erc-identd'.
**** New function: `erc-identd-quickstart'
Ignores any arguments and calls `erc-identd-start'.
*** Channel lists (erc-list.el)
**** Enable by default, except in the version of ERC bundled with Emacs 22.
*** Logging (erc-log.el)
**** Make sure filenames are safe to use before writing to them.
**** Save all log buffers when exiting Emacs.
**** erc-generate-log-file-name-function: Add option for
`erc-generate-log-file-name-network', which is a new function that
uses the network name rather than the server name when possible.
*** Menu (erc-menu.el)
**** Name the menu "ERC" instead of "IRC" to avoid confusion with rcirc
and other clients.
**** Make this into a proper module and load it by default.
**** Add "Current channel" submenu.
*** Networks (erc-networks.el)
**** Add support for Ars OpenIRC, LinuxChix, and OFTC networks.
**** Escape periods in Konfido.Net and Kewl.Org.
*** Internet services / Nickserv (erc-nickserv.el)
**** Add new 'both method for the `erc-nickserv-identify-mode' option
and make it the default. This tries to do the right thing both when a
known nickserv message exists for an IRC network, and when it does
not.
**** Support nickserv authentication on OFTC, Azzurra, Ars, and QuakeNet.
**** Support authentication on BitlBee.
**** Make source code easier to understand by using accessor functions.
*** Sound support (erc-sound.el)
**** Make this work with both Emacs 21 and Emacs 22.
*** Timestamps (erc-stamp.el)
**** Exclude the newline from the erc-timestamp field.
**** New function: `erc-toggle-timestamps'.
Toggles display of timestamps.
* Changes in ERC 5.1.4
** Make find-function and find-variable work in Emacs 22 for
@ -156,6 +388,10 @@ to make the BBDB buffer electric. This defaults to not electric.
**** Don't create an extra buffer for the identd process.
*** Channel lists (erc-list.el)
**** Enable by default, except in the version of ERC bundled with Emacs 22.
*** Logging (erc-log.el)
**** By default, don't insert old logs when opening an ERC buffer.

File diff suppressed because it is too large Load diff

1457
lisp/erc/ChangeLog.06 Normal file

File diff suppressed because it is too large Load diff

View file

@ -40,6 +40,49 @@ yourself back when you type something."
"The Emacs idletimer.
This is only used when `erc-autoaway-idle-method' is set to 'emacs.")
(defvar erc-autoaway-last-sent-time (erc-current-time)
"The last time the user sent something.")
(defvar erc-autoaway-caused-away nil
"Indicates whether this module was responsible for setting the
user's away status.")
(eval-when-compile (defvar erc-autoaway-idle-seconds))
(defun erc-autoaway-reestablish-idletimer ()
"Reestablish the Emacs idletimer.
If `erc-autoaway-idle-method' is 'emacs, you must call this
function each time you change `erc-autoaway-idle-seconds'."
(interactive)
(when erc-autoaway-idletimer
(erc-cancel-timer erc-autoaway-idletimer))
(setq erc-autoaway-idletimer
(run-with-idle-timer erc-autoaway-idle-seconds
t
'erc-autoaway-set-away
erc-autoaway-idle-seconds)))
(defun erc-autoaway-some-server-buffer ()
"Return some ERC server buffer if its connection is alive.
If none is found, return nil."
(car (erc-buffer-list #'erc-open-server-buffer-p)))
(defun erc-autoaway-insinuate-maybe (&optional server &rest ignored)
"Add autoaway reset function to `post-command-hook' if at least one
ERC process is alive.
This is used when `erc-autoaway-idle-method' is 'user."
(when (or server (erc-autoaway-some-server-buffer))
(add-hook 'post-command-hook 'erc-autoaway-reset-idle-user)))
(defun erc-autoaway-remove-maybe (&rest ignored)
"Remove the autoaway reset function from `post-command-hook' if
no ERC process is alive.
This is used when `erc-autoaway-idle-method' is 'user."
(unless (erc-autoaway-some-server-buffer)
(remove-hook 'post-command-hook 'erc-autoaway-reset-idle-user)))
;;;###autoload (autoload 'erc-autoaway-mode "erc-autoaway")
(define-erc-module autoaway nil
"In ERC autoaway mode, you can be set away automatically.
@ -65,24 +108,31 @@ set you no longer away.
Related variables: `erc-public-away-p' and `erc-away-nickname'."
;; Enable:
((when (boundp 'erc-autoaway-idle-method)
(add-hook 'erc-connect-pre-hook 'erc-autoaway-reset-indicators)
(setq erc-autoaway-last-sent-time (erc-current-time))
(cond
((eq erc-autoaway-idle-method 'irc)
(add-hook 'erc-send-completed-hook 'erc-autoaway-reset-idle-irc)
(add-hook 'erc-server-001-functions 'erc-autoaway-reset-idle-irc))
((eq erc-autoaway-idle-method 'user)
(add-hook 'post-command-hook 'erc-autoaway-reset-idle-user))
(add-hook 'erc-after-connect 'erc-autoaway-insinuate-maybe)
(add-hook 'erc-disconnected-hook 'erc-autoaway-remove-maybe)
(erc-autoaway-insinuate-maybe))
((eq erc-autoaway-idle-method 'emacs)
(erc-autoaway-reestablish-idletimer)))
(add-hook 'erc-timer-hook 'erc-autoaway-possibly-set-away)
(add-hook 'erc-server-305-functions 'erc-autoaway-reset-indicators)))
;; Disable:
((when (boundp 'erc-autoaway-idle-method)
(remove-hook 'erc-connect-pre-hook 'erc-autoaway-reset-indicators)
(cond
((eq erc-autoaway-idle-method 'irc)
(remove-hook 'erc-send-completed-hook 'erc-autoaway-reset-idle-irc)
(remove-hook 'erc-server-001-functions 'erc-autoaway-reset-idle-irc))
((eq erc-autoaway-idle-method 'user)
(remove-hook 'post-command-hook 'erc-autoaway-reset-idle-user))
(remove-hook 'post-command-hook 'erc-autoaway-reset-idle-user)
(remove-hook 'erc-after-connect 'erc-autoaway-insinuate-maybe)
(remove-hook 'erc-disconnected-hook 'erc-autoaway-remove-maybe))
((eq erc-autoaway-idle-method 'emacs)
(erc-cancel-timer erc-autoaway-idletimer)
(setq erc-autoaway-idletimer nil)))
@ -104,9 +154,12 @@ definitions of being idle."
(const :tag "Emacs idle time" emacs)
(const :tag "Last IRC action" irc))
:set (lambda (sym val)
(erc-autoaway-disable)
(set-default sym val)
(erc-autoaway-enable)))
(if erc-autoaway-mode
(progn
(erc-autoaway-disable)
(set sym val)
(erc-autoaway-enable))
(set sym val))))
(defcustom erc-auto-set-away t
"*If non-nil, set away after `erc-autoaway-idle-seconds' seconds of idling.
@ -133,21 +186,6 @@ See `erc-auto-discard-away'."
:group 'erc-autoaway
:type 'regexp)
(eval-when-compile (defvar erc-autoaway-idle-seconds))
(defun erc-autoaway-reestablish-idletimer ()
"Reestablish the Emacs idletimer.
If `erc-autoaway-idle-method' is 'emacs, you must call this
function each time you change `erc-autoaway-idle-seconds'."
(interactive)
(when erc-autoaway-idletimer
(erc-cancel-timer erc-autoaway-idletimer))
(setq erc-autoaway-idletimer
(run-with-idle-timer erc-autoaway-idle-seconds
t
'erc-autoaway-set-away
erc-autoaway-idle-seconds)))
(defcustom erc-autoaway-idle-seconds 1800
"*Number of seconds after which ERC will set you automatically away.
If you are changing this variable using lisp instead of customizing it,
@ -167,19 +205,12 @@ in seconds."
:group 'erc-autoaway
:type 'string)
(defvar erc-autoaway-last-sent-time (erc-current-time)
"The last time the user sent something.")
(defvar erc-autoaway-caused-away nil
"Indicates whether this module was responsible for setting the
user's away status.")
(defun erc-autoaway-reset-idle-user (&rest stuff)
"Reset the stored user idle time.
This is one global variable since a user talking on one net can
talk on another net too."
(when erc-auto-discard-away
(erc-autoaway-set-back))
(erc-autoaway-set-back #'erc-autoaway-remove-maybe))
(setq erc-autoaway-last-sent-time (erc-current-time)))
(defun erc-autoaway-reset-idle-irc (line &rest stuff)
@ -192,12 +223,24 @@ talk on another net too."
(erc-autoaway-set-back))
(setq erc-autoaway-last-sent-time (erc-current-time)))
(defun erc-autoaway-set-back ()
"Discard the away state globally."
(let ((server-buffer (car (erc-buffer-list #'erc-server-buffer-p))))
(when (and erc-autoaway-caused-away
(with-current-buffer server-buffer (erc-away-p)))
(erc-cmd-GAWAY ""))))
(defun erc-autoaway-set-back (&optional none-alive-func)
"Discard the away state globally.
NONE-ALIVE-FUNC is the function to call if no ERC processes are alive."
(let ((server-buffer (erc-autoaway-some-server-buffer)))
(if (and erc-autoaway-caused-away
(buffer-live-p server-buffer)
(with-current-buffer server-buffer erc-away))
(erc-cmd-GAWAY "")
(when none-alive-func (funcall none-alive-func)))))
(defun erc-autoaway-some-open-server-buffer ()
"Return some ERC server buffer if its connection is alive and the
user is not away.
If none is found, return nil."
(car (erc-buffer-list (lambda ()
(and (erc-open-server-buffer-p)
(not erc-away))))))
(defun erc-autoaway-possibly-set-away (current-time)
"Set autoaway when `erc-auto-set-away' is true and the idletime is
@ -207,7 +250,7 @@ exceeds `erc-autoaway-idle-seconds'."
;; whenever the server sends something to the client.
(when (and erc-auto-set-away
(not erc-autoaway-caused-away)
(not (erc-away-p)))
(erc-autoaway-some-open-server-buffer))
(let ((idle-time (erc-time-diff erc-autoaway-last-sent-time
current-time)))
(when (>= idle-time erc-autoaway-idle-seconds)
@ -215,15 +258,17 @@ exceeds `erc-autoaway-idle-seconds'."
nil 'notice nil
(format "Setting automatically away after %i seconds of idle-time"
idle-time))
(erc-autoaway-set-away idle-time)))))
(erc-autoaway-set-away idle-time t)))))
(defun erc-autoaway-set-away (idle-time)
"Set the away state globally."
(defun erc-autoaway-set-away (idle-time &optional notest)
"Set the away state globally.
If NOTEST is specified, do not check to see whether there is an
activer server buffer available."
;; Note that the idle timer runs, even when Emacs is inactive. In
;; order to prevent flooding when we connect, we test for an
;; existing process.
(when (and (erc-server-process-alive)
(not (erc-away-p)))
(when (or notest (erc-autoaway-some-open-server-buffer))
(setq erc-autoaway-caused-away t)
(erc-cmd-GAWAY (format erc-autoaway-message idle-time))))

View file

@ -174,9 +174,15 @@ WALLCHOPS - supports sending messages to all operators in a channel")
;;; Server and connection state
(defvar erc-server-ping-timer-alist nil
"Mapping of server buffers to their specific ping timer.")
(defvar erc-server-connected nil
"Non-nil if the `current-buffer' is associated with an open IRC connection.
This variable is buffer-local.")
"Non-nil if the current buffer has been used by ERC to establish
an IRC connection.
If you wish to determine whether an IRC connection is currently
active, use the `erc-server-process-alive' function instead.")
(make-variable-buffer-local 'erc-server-connected)
(defvar erc-server-reconnect-count 0
@ -187,10 +193,23 @@ This variable is buffer-local.")
"Non-nil if the user requests a quit.")
(make-variable-buffer-local 'erc-server-quitting)
(defvar erc-server-reconnecting nil
"Non-nil if the user requests an explicit reconnect, and the
current IRC process is still alive.")
(make-variable-buffer-local 'erc-server-reconnecting)
(defvar erc-server-timed-out nil
"Non-nil if the IRC server failed to respond to a ping.")
(make-variable-buffer-local 'erc-server-timed-out)
(defvar erc-server-banned nil
"Non-nil if the user is denied access because of a server ban.")
(make-variable-buffer-local 'erc-server-banned)
(defvar erc-server-error-occurred nil
"Non-nil if the user triggers some server error.")
(make-variable-buffer-local 'erc-server-error-occurred)
(defvar erc-server-lines-sent nil
"Line counter.")
(make-variable-buffer-local 'erc-server-lines-sent)
@ -210,6 +229,11 @@ This is useful for flood protection.")
This is useful for flood protection.")
(make-variable-buffer-local 'erc-server-last-ping-time)
(defvar erc-server-last-received-time nil
"Time the last message was received from the server.
This is useful for detecting hung connections.")
(make-variable-buffer-local 'erc-server-last-received-time)
(defvar erc-server-lag nil
"Calculated server lag time in seconds.
This variable is only set in a server buffer.")
@ -387,11 +411,24 @@ protection algorithm."
;; Ping handling
(defcustom erc-server-send-ping-interval 90
(defcustom erc-server-send-ping-interval 30
"*Interval of sending pings to the server, in seconds.
If this is set to nil, pinging the server is disabled."
:group 'erc-server
:type '(choice (const nil) (integer :tag "Seconds")))
:type '(choice (const :tag "Disabled" nil)
(integer :tag "Seconds")))
(defcustom erc-server-send-ping-timeout 120
"*If the time between ping and response is greater than this, reconnect.
The time is in seconds.
This must be greater than or equal to the value for
`erc-server-send-ping-interval'.
If this is set to nil, never try to reconnect."
:group 'erc-server
:type '(choice (const :tag "Disabled" nil)
(integer :tag "Seconds")))
(defvar erc-server-ping-handler nil
"This variable holds the periodic ping timer.")
@ -424,20 +461,40 @@ Currently this is called by `erc-send-input'."
(upcase-word 1)
(buffer-string)))
(defun erc-server-setup-periodical-server-ping (&rest ignore)
"Set up a timer to periodically ping the current server."
(and erc-server-ping-handler (erc-cancel-timer erc-server-ping-handler))
(when erc-server-send-ping-interval
(setq erc-server-ping-handler
(run-with-timer
4 erc-server-send-ping-interval
(lambda (buf)
(when (buffer-live-p buf)
(with-current-buffer buf
(erc-server-send
(format "PING %.0f"
(erc-current-time))))))
(current-buffer)))))
(defun erc-server-send-ping (buf)
"Send a ping to the IRC server buffer in BUF.
Additionally, detect whether the IRC process has hung."
(if (buffer-live-p buf)
(with-current-buffer buf
(if (and erc-server-send-ping-timeout
(>
(erc-time-diff (erc-current-time)
erc-server-last-received-time)
erc-server-send-ping-timeout))
(progn
;; if the process is hung, kill it
(setq erc-server-timed-out t)
(delete-process erc-server-process))
(erc-server-send (format "PING %.0f" (erc-current-time)))))
;; remove timer if the server buffer has been killed
(let ((timer (assq buf erc-server-ping-timer-alist)))
(when timer
(erc-cancel-timer (cdr timer))
(setcdr timer nil)))))
(defun erc-server-setup-periodical-ping (buffer)
"Set up a timer to periodically ping the current server.
The current buffer is given by BUFFER."
(with-current-buffer buffer
(and erc-server-ping-handler (erc-cancel-timer erc-server-ping-handler))
(when erc-server-send-ping-interval
(setq erc-server-ping-handler (run-with-timer
4 erc-server-send-ping-interval
#'erc-server-send-ping
buffer))
(setq erc-server-ping-timer-alist (cons (cons buffer
erc-server-ping-handler)
erc-server-ping-timer-alist)))))
(defun erc-server-process-alive ()
"Return non-nil when `erc-server-process' is open or running."
@ -447,40 +504,47 @@ Currently this is called by `erc-send-input'."
;;;; Connecting to a server
(defun erc-server-connect (server port)
"Perform the connection and login.
We will store server variables in the current buffer."
(defun erc-server-connect (server port buffer)
"Perform the connection and login using the specified SERVER and PORT.
We will store server variables in the buffer given by BUFFER."
(let ((msg (erc-format-message 'connect ?S server ?p port)))
(message "%s" msg)
(setq erc-server-process
(funcall erc-server-connect-function
(format "erc-%s-%s" server port)
(current-buffer) server port))
(message "%s...done" msg))
;; Misc server variables
(setq erc-server-quitting nil)
(setq erc-server-banned nil)
(setq erc-server-last-sent-time (erc-current-time))
(setq erc-server-last-ping-time (erc-current-time))
(setq erc-server-lines-sent 0)
;; last peers (sender and receiver)
(setq erc-server-last-peers '(nil . nil))
;; process handlers
(set-process-sentinel erc-server-process 'erc-process-sentinel)
(set-process-filter erc-server-process 'erc-server-filter-function)
;; we do our own encoding and decoding
(when (fboundp 'set-process-coding-system)
(set-process-coding-system erc-server-process 'raw-text))
(set-marker (process-mark erc-server-process) (point))
(let ((process (funcall erc-server-connect-function
(format "erc-%s-%s" server port)
nil server port)))
(message "%s...done" msg)
;; Misc server variables
(with-current-buffer buffer
(setq erc-server-process process)
(setq erc-server-quitting nil)
(setq erc-server-reconnecting nil)
(setq erc-server-timed-out nil)
(setq erc-server-banned nil)
(setq erc-server-error-occurred nil)
(let ((time (erc-current-time)))
(setq erc-server-last-sent-time time)
(setq erc-server-last-ping-time time)
(setq erc-server-last-received-time time))
(setq erc-server-lines-sent 0)
;; last peers (sender and receiver)
(setq erc-server-last-peers '(nil . nil)))
;; we do our own encoding and decoding
(when (fboundp 'set-process-coding-system)
(set-process-coding-system process 'raw-text))
;; process handlers
(set-process-sentinel process 'erc-process-sentinel)
(set-process-filter process 'erc-server-filter-function)
(set-process-buffer process buffer)))
(erc-log "\n\n\n********************************************\n")
(message (erc-format-message 'login ?n (erc-current-nick)))
(message (erc-format-message
'login ?n
(with-current-buffer buffer (erc-current-nick))))
;; wait with script loading until we receive a confirmation (first
;; MOTD line)
(if (eq erc-server-connect-function 'open-network-stream-nowait)
;; it's a bit unclear otherwise that it's attempting to establish a
;; connection
(erc-display-message nil nil (current-buffer)
"Opening connection..\n")
(erc-display-message nil nil buffer "Opening connection..\n")
(erc-login)))
(defun erc-server-reconnect ()
@ -501,6 +565,7 @@ Make sure you are in an ERC buffer when running this."
(defun erc-server-filter-function (process string)
"The process filter for the ERC server."
(with-current-buffer (process-buffer process)
(setq erc-server-last-received-time (erc-current-time))
;; If you think this is written in a weird way - please refer to the
;; docstring of `erc-server-processing-p'
(if erc-server-processing-p
@ -529,16 +594,20 @@ Make sure you are in an ERC buffer when running this."
(defsubst erc-server-reconnect-p (event)
"Return non-nil if ERC should attempt to reconnect automatically.
EVENT is the message received from the closed connection process."
(and erc-server-auto-reconnect
(not erc-server-banned)
;; make sure we don't infinitely try to reconnect, unless the
;; user wants that
(or (eq erc-server-reconnect-attempts t)
(and (integerp erc-server-reconnect-attempts)
(< erc-server-reconnect-count erc-server-reconnect-attempts)))
(not (string-match "^deleted" event))
;; open-network-stream-nowait error for connection refused
(not (string-match "^failed with code 111" event))))
(or erc-server-reconnecting
(and erc-server-auto-reconnect
(not erc-server-banned)
(not erc-server-error-occurred)
;; make sure we don't infinitely try to reconnect, unless the
;; user wants that
(or (eq erc-server-reconnect-attempts t)
(and (integerp erc-server-reconnect-attempts)
(< erc-server-reconnect-count
erc-server-reconnect-attempts)))
(or erc-server-timed-out
(not (string-match "^deleted" event)))
;; open-network-stream-nowait error for connection refused
(not (string-match "^failed with code 111" event)))))
(defun erc-process-sentinel-1 (event)
"Called when `erc-process-sentinel' has decided that we're disconnecting.
@ -562,6 +631,7 @@ Conditionally try to reconnect and take appropriate action."
(if (erc-server-reconnect-p event)
(condition-case err
(progn
(setq erc-server-reconnecting nil)
(erc-server-reconnect)
(setq erc-server-reconnect-count 0))
(error (when (integerp erc-server-reconnect-attempts)
@ -611,6 +681,7 @@ Conditionally try to reconnect and take appropriate action."
"Return the coding system or cons cell appropriate for TARGET.
This is determined via `erc-encoding-coding-alist' or
`erc-server-coding-system'."
(unless target (setq target (erc-default-target)))
(or (when target
(let ((case-fold-search t))
(catch 'match
@ -656,14 +727,11 @@ See `erc-server-flood-margin' for an explanation of the flood
protection algorithm."
(erc-log (concat "erc-server-send: " string "(" (buffer-name) ")"))
(setq erc-server-last-sent-time (erc-current-time))
(let ((buf (erc-server-buffer))
(encoding (erc-coding-system-for-target
(or target (erc-default-target)))))
(let ((encoding (erc-coding-system-for-target target)))
(when (consp encoding)
(setq encoding (car encoding)))
(if (and buf
(erc-server-process-alive))
(with-current-buffer buf
(if (erc-server-process-alive)
(erc-with-server-buffer
(let ((str (concat string "\r\n")))
(if forcep
(progn
@ -903,10 +971,8 @@ Finds hooks by looking in the `erc-server-responses' hashtable."
(let ((hook (or (erc-get-hook (erc-response.command message))
'erc-default-server-functions)))
(run-hook-with-args-until-success hook process message)
(let ((server-buffer (erc-server-buffer)))
(when (buffer-live-p server-buffer)
(with-current-buffer server-buffer
(run-hook-with-args 'erc-timer-hook (erc-current-time)))))))
(erc-with-server-buffer
(run-hook-with-args 'erc-timer-hook (erc-current-time)))))
(add-hook 'erc-default-server-functions 'erc-handle-unknown-server-response)
@ -1062,6 +1128,7 @@ add things to `%s' instead."
(define-erc-response-handler (ERROR)
"Handle an ERROR command from the server." nil
(setq erc-server-error-occurred t)
(erc-display-message
parsed 'error nil 'ERROR
?s (erc-response.sender parsed) ?c (erc-response.contents parsed)))
@ -1446,6 +1513,9 @@ A server may send more than one 005 message."
See `erc-display-server-message'." nil
(erc-display-server-message proc parsed))
(define-erc-response-handler (290)
"Handle dancer-ircd CAPAB messages." nil nil)
(define-erc-response-handler (301)
"AWAY notice." nil
(erc-display-message parsed 'notice 'active 's301

View file

@ -56,10 +56,12 @@
"This mode buttonizes all messages according to `erc-button-alist'."
((add-hook 'erc-insert-modify-hook 'erc-button-add-buttons 'append)
(add-hook 'erc-send-modify-hook 'erc-button-add-buttons 'append)
(add-hook 'erc-complete-functions 'erc-button-next))
(add-hook 'erc-complete-functions 'erc-button-next)
(add-hook 'erc-mode-hook 'erc-button-add-keys))
((remove-hook 'erc-insert-modify-hook 'erc-button-add-buttons)
(remove-hook 'erc-send-modify-hook 'erc-button-add-buttons)
(remove-hook 'erc-complete-functions 'erc-button-next)))
(remove-hook 'erc-complete-functions 'erc-button-next)
(remove-hook 'erc-mode-hook 'erc-button-add-keys)))
;; Make XEmacs use `erc-button-face'.
(when (featurep 'xemacs)
@ -241,6 +243,16 @@ PAR is a number of a regexp grouping whose text will be passed to
This syntax table should make all the legal nick characters word
constituents.")
(defvar erc-button-keys-added nil
"Internal variable used to keep track of whether we've added the
global-level ERC button keys yet.")
(defun erc-button-add-keys ()
"Add ERC mode-level button movement keys. This is only done once."
(unless erc-button-keys-added
(define-key erc-mode-map (kbd "<backtab>") 'erc-button-previous)
(setq erc-button-keys-added t)))
(defun erc-button-add-buttons ()
"Find external references in the current buffer and make buttons of them.
\"External references\" are things like URLs, as

View file

@ -56,8 +56,10 @@
;; (erc-capab-identify-mode 1)
;; `erc-capab-identify-prefix' will now be added to the beginning of
;; unidentified users' nicknames. The default is an asterisk, "*". If
;; the value of this variable is nil or you disable this module (see
;; unidentified users' nicknames. The default is an asterisk, "*".
;; You can customize the prefix and the face used to display it,
;; `erc-capab-identify-unidentified'. If the value of
;; `erc-capab-identify-prefix' is nil or you disable this module (see
;; `erc-capab-identify-disable'), no prefix will be inserted, but the
;; flag sent by the server will still be stripped.
@ -73,14 +75,19 @@
:group 'erc)
(defcustom erc-capab-identify-prefix "*"
"The prefix used for unidentified users."
"The prefix used for unidentified users.
If you change this from the default \"*\", be sure to use a
character not found in IRC nicknames to avoid confusion."
:group 'erc-capab
:type '(choice string (const nil)))
;;; Define module:
(defface erc-capab-identify-unidentified '((t)) ; same as `erc-default-face'
"Face to use for `erc-capab-identify-prefix'."
:group 'erc-capab
:group 'erc-faces)
(define-erc-response-handler (290)
"Handle dancer-ircd CAPAB messages." nil nil)
;;; Define module:
;;;###autoload (autoload 'erc-capab-identify-mode "erc-capab" nil t)
(define-erc-module capab-identify nil
@ -124,9 +131,9 @@ Optional argument PARSED is the current message, a response struct.
These arguments are sent to this function when called as a hook in
`erc-server-005-functions'."
(unless erc-capab-identify-sent
(erc-capab-send-identify-messages)))
(erc-capab-identify-send-messages)))
(defun erc-capab-send-identify-messages ()
(defun erc-capab-identify-send-messages ()
"Send CAPAB IDENTIFY messages if the server supports it."
(when (and (stringp erc-server-version)
(string-match "^\\(dancer-ircd\\|hyperion\\)" erc-server-version)
@ -175,7 +182,7 @@ PARSED is an `erc-parsed' response struct."
(when (and erc-capab-identify-prefix
(erc-with-server-buffer erc-capab-identify-activated))
(goto-char (or (erc-find-parsed-property) (point-min)))
(let ((nickname (erc-capab-get-unidentified-nickname
(let ((nickname (erc-capab-identify-get-unidentified-nickname
(erc-get-parsed-vector (point)))))
(when (and nickname
(goto-char (point-min))
@ -183,10 +190,9 @@ PARSED is an `erc-parsed' response struct."
(re-search-forward (regexp-quote nickname) nil t))
(goto-char (match-beginning 0))
(insert (erc-propertize erc-capab-identify-prefix
'face (get-char-property (- (point) 1)
'face)))))))
'face 'erc-capab-identify-unidentified))))))
(defun erc-capab-get-unidentified-nickname (parsed)
(defun erc-capab-identify-get-unidentified-nickname (parsed)
"Return the nickname of the user if unidentified.
PARSED is an `erc-parsed' response struct."
(when (and (erc-response-p parsed)

View file

@ -161,14 +161,6 @@ avoid corrupting the original SEQ."
(setq newseq (cons el newseq))))
(nreverse newseq)))
;; Provide a simpler replacement for `gensym'.
(defvar *erc-sym-counter* 0)
(defun erc-gensym ()
"Generate a new uninterned symbol."
(let ((num (prog1 *erc-sym-counter*
(setq *erc-sym-counter* (1+ *erc-sym-counter*)))))
(make-symbol (format "*erc-sym-%d*" num))))
;; Copied from cl-extra.el
(defun erc-subseq (seq start &optional end)
"Return the subsequence of SEQ from START to END.

View file

@ -1,6 +1,7 @@
;;; erc-fill.el --- Filling IRC messages in various ways
;; Copyright (C) 2001, 2002, 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
;; Copyright (C) 2001, 2002, 2003, 2004, 2006,
;; 2007 Free Software Foundation, Inc.
;; Author: Andreas Fuchs <asf@void.at>
;; Mario Lang <mlang@delysid.org>
@ -187,14 +188,6 @@ You can put this on `erc-insert-modify-hook' and/or `erc-send-modify-hook'."
(length (format-time-string erc-timestamp-format))
0))
(defun erc-restore-text-properties ()
"Restore the property 'erc-parsed for the region."
(let* ((parsed-posn (text-property-not-all (point-min) (point-max)
'erc-parsed nil))
(parsed-prop (when parsed-posn
(get-text-property parsed-posn 'erc-parsed))))
(put-text-property (point-min) (point-max) 'erc-parsed parsed-prop)))
(provide 'erc-fill)
;;; erc-fill.el ends here

View file

@ -127,8 +127,7 @@
(define-ibuffer-column erc-away (:name "A")
(if (and erc-server-process
(processp erc-server-process)
(with-current-buffer (process-buffer erc-server-process)
erc-away))
(erc-away-time))
"A"
" "))

View file

@ -42,12 +42,26 @@
(defvar erc-identd-process nil)
(defgroup erc-identd nil
"Run a local identd server."
:group 'erc)
(defcustom erc-identd-port 8113
"Port to run the identd server on if not specified in the argument for
`erc-identd-start'.
This can be either a string or a number."
:group 'erc-identd
:type '(choice (const :tag "None" nil)
(integer :tag "Port number")
(string :tag "Port string")))
;;;###autoload (autoload 'erc-identd-mode "erc-identd")
(define-erc-module identd nil
"This mode launches an identd server on port 8113."
((add-hook 'erc-connect-pre-hook 'erc-identd-start)
((add-hook 'erc-connect-pre-hook 'erc-identd-quickstart)
(add-hook 'erc-disconnected-hook 'erc-identd-stop))
((remove-hook 'erc-connect-pre-hook 'erc-identd-start)
((remove-hook 'erc-connect-pre-hook 'erc-identd-quickstart)
(remove-hook 'erc-disconnected-hook 'erc-identd-stop)))
(defun erc-identd-filter (proc string)
@ -71,12 +85,11 @@ run from inetd. The idea is to provide a simple identd server
when you need one, without having to install one globally on your
system."
(interactive (list (read-string "Serve identd requests on port: " "8113")))
(if (null port)
(setq port 8113)
(if (stringp port)
(setq port (string-to-number port))))
(if erc-identd-process
(delete-process erc-identd-process))
(unless port (setq port erc-identd-port))
(when (stringp port)
(setq port (string-to-number port)))
(when erc-identd-process
(delete-process erc-identd-process))
(setq erc-identd-process
(make-network-process :name "identd"
:buffer nil
@ -85,6 +98,11 @@ system."
:filter 'erc-identd-filter))
(set-process-query-on-exit-flag erc-identd-process nil))
(defun erc-identd-quickstart (&rest ignored)
"Start the identd server with the default port.
The default port is specified by `erc-identd-port'."
(erc-identd-start))
;;;###autoload
(defun erc-identd-stop (&rest ignore)
(interactive)

View file

@ -85,7 +85,9 @@
;;; Code:
(require 'erc)
(eval-when-compile (require 'cl))
(eval-when-compile
(require 'erc-networks)
(require 'cl))
(defgroup erc-log nil
"Logging facilities for ERC."
@ -100,10 +102,12 @@ NICK is the current nick,
SERVER and PORT are the parameters used to connect BUFFERs
`erc-server-process'."
:group 'erc-log
:type '(choice (const erc-generate-log-file-name-long)
(const erc-generate-log-file-name-short)
(const erc-generate-log-file-name-with-date)
(symbol)))
:type '(choice (const :tag "Long style" erc-generate-log-file-name-long)
(const :tag "Long, but with network name rather than server"
erc-generate-log-file-name-network)
(const :tag "Short" erc-generate-log-file-name-short)
(const :tag "With date" erc-generate-log-file-name-with-date)
(symbol :tag "Other function")))
(defcustom erc-truncate-buffer-on-save nil
"Truncate any ERC (channel, query, server) buffer when it is saved."
@ -197,7 +201,7 @@ also be a predicate function. To only log when you are not set away, use:
\(setq erc-enable-logging
(lambda (buffer)
(with-current-buffer buffer
(not erc-away))))"
(null (erc-away-time)))))"
;; enable
((when erc-log-write-after-insert
(add-hook 'erc-insert-post-hook 'erc-save-buffer-in-logs))
@ -211,8 +215,7 @@ also be a predicate function. To only log when you are not set away, use:
;; append, so that 'erc-initialize-log-marker runs first
(add-hook 'erc-connect-pre-hook 'erc-log-setup-logging 'append)
(dolist (buffer (erc-buffer-list))
(when (buffer-live-p buffer)
(with-current-buffer buffer (erc-log-setup-logging)))))
(erc-log-setup-logging buffer)))
;; disable
((remove-hook 'erc-insert-post-hook 'erc-save-buffer-in-logs)
(remove-hook 'erc-send-post-hook 'erc-save-buffer-in-logs)
@ -223,30 +226,38 @@ also be a predicate function. To only log when you are not set away, use:
(remove-hook 'erc-part-hook 'erc-conditional-save-buffer)
(remove-hook 'erc-connect-pre-hook 'erc-log-setup-logging)
(dolist (buffer (erc-buffer-list))
(when (buffer-live-p buffer)
(with-current-buffer buffer (erc-log-disable-logging))))))
(erc-log-disable-logging buffer))))
(define-key erc-mode-map "\C-c\C-l" 'erc-save-buffer-in-logs)
;;; functionality referenced from erc.el
(defun erc-log-setup-logging ()
(defun erc-log-setup-logging (buffer)
"Setup the buffer-local logging variables in the current buffer.
This function is destined to be run from `erc-connect-pre-hook'."
(when (erc-logging-enabled)
(auto-save-mode -1)
(setq buffer-file-name nil)
(set (make-local-variable 'write-file-functions)
'(erc-save-buffer-in-logs))
(when erc-log-insert-log-on-open
(ignore-errors (insert-file-contents (erc-current-logfile))
(move-marker erc-last-saved-position
(1- (point-max)))))))
This function is destined to be run from `erc-connect-pre-hook'.
The current buffer is given by BUFFER."
(when (erc-logging-enabled buffer)
(with-current-buffer buffer
(auto-save-mode -1)
(setq buffer-file-name nil)
(cond ((boundp 'write-file-functions)
(set (make-local-variable 'write-file-functions)
'(erc-save-buffer-in-logs)))
((boundp 'local-write-file-hooks)
(setq local-write-file-hooks '(erc-save-buffer-in-logs)))
(t
(set (make-local-variable 'write-file-hooks)
'(erc-save-buffer-in-logs))))
(when erc-log-insert-log-on-open
(ignore-errors (insert-file-contents (erc-current-logfile))
(move-marker erc-last-saved-position
(1- (point-max))))))))
(defun erc-log-disable-logging ()
"Disable logging in the current buffer."
(when (erc-logging-enabled)
(setq buffer-offer-save nil
erc-enable-logging nil)))
(defun erc-log-disable-logging (buffer)
"Disable logging in BUFFER."
(when (erc-logging-enabled buffer)
(with-current-buffer buffer
(setq buffer-offer-save nil
erc-enable-logging nil))))
(defun erc-log-all-but-server-buffers (buffer)
"Returns t if logging should be enabled in BUFFER.
@ -340,6 +351,19 @@ This function is a possible value for `erc-generate-log-file-name-function'."
;; we need a make-safe-file-name function.
(convert-standard-filename file)))
(defun erc-generate-log-file-name-network (buffer target nick server port)
"Generates a log-file name using the network name rather than server name.
This results in a file name of the form #channel!nick@network.txt.
This function is a possible value for `erc-generate-log-file-name-function'."
(require 'erc-networks)
(let ((file (concat
(if target (concat target "!"))
nick "@"
(or (with-current-buffer buffer (erc-network-name)) server)
".txt")))
;; we need a make-safe-file-name function.
(convert-standard-filename file)))
;;;###autoload
(defun erc-save-buffer-in-logs (&optional buffer)
"Append BUFFER contents to the log file, if logging is enabled.

View file

@ -1,6 +1,7 @@
;;; erc-match.el --- Highlight messages matching certain regexps
;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
;; Copyright (C) 2002, 2003, 2004, 2005, 2006,
;; 2007 Free Software Foundation, Inc.
;; Author: Andreas Fuchs <asf@void.at>
;; Keywords: comm, faces
@ -540,7 +541,7 @@ deactivate/activate match logging in the latter. See
(when (and
(or (eq erc-log-matches-flag t)
(and (eq erc-log-matches-flag 'away)
erc-away))
(erc-away-time)))
match-buffer-name)
(let ((line (format-spec erc-log-match-format
(format-spec-make
@ -572,7 +573,7 @@ deactivate/activate match logging in the latter. See
(defun erc-log-matches-come-back (proc parsed)
"Display a notice that messages were logged while away."
(when (and erc-away
(when (and (erc-away-time)
(eq erc-log-matches-flag 'away))
(mapc
(lambda (match-type)
@ -583,7 +584,7 @@ deactivate/activate match logging in the latter. See
(with-current-buffer buffer
(get-text-property (1- (point-max))
'timestamp))))
(away-time (erc-emacs-time-to-erc-time erc-away)))
(away-time (erc-emacs-time-to-erc-time (erc-away-time))))
(when (and away-time last-msg-time
(erc-time-gt last-msg-time away-time))
(erc-display-message

View file

@ -1,6 +1,7 @@
;; erc-menu.el -- Menu-bar definitions for ERC
;; Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
;; Copyright (C) 2001, 2002, 2004, 2005, 2006,
;; 2007 Free Software Foundation, Inc.
;; Author: Mario Lang <mlang@delysid.org>
;; Keywords: comm, processes, menu
@ -75,8 +76,8 @@
(erc-channel-user-op-p (erc-current-nick))]
["Set a key..." erc-set-channel-key
(erc-channel-user-op-p (erc-current-nick))])
["Leave this channel..." erc-part-from-channel erc-channel-users]
"-")
["Leave this channel..." erc-part-from-channel erc-channel-users])
"-"
(list "Pals, fools and other keywords"
["Add pal..." erc-add-pal]
["Delete pal..." erc-delete-pal]

View file

@ -184,7 +184,7 @@ join from that split has been detected or not.")
;;;###autoload
(defun erc-cmd-WHOLEFT ()
"Show who's gone."
(with-current-buffer (erc-server-buffer)
(erc-with-server-buffer
(if (null erc-netsplit-list)
(erc-display-message
nil 'notice 'active

View file

@ -317,6 +317,7 @@
("Novernet: Random server" Novernet "irc.novernet.com" ((6665 6669) 7000 ))
("Nullrouted: Random server" Nullrouted "irc.nullrouted.org" ((6666 6669) 7000 ))
("NullusNet: Random server" NullusNet "irc.nullus.net" 6667)
("OFTC: Random server" OFTC "irc.oftc.net" ((6667 6670) 7000))
("OpChat: Random server" OpChat "irc.opchat.org" ((6667 6669)))
("Othernet: Random server" Othernet "irc.othernet.org" 6667)
("Othernet: US, FL, Miami" Othernet "miami.fl.us.othernet.org" 6667)
@ -611,6 +612,7 @@ PORTS is either a number, a list of numbers, or a list of port ranges."
(Novernet "novernet.com")
(Nullrouted "nullrouted.org")
(NullusNet "nullus.net")
(OFTC "oftc.net")
(OpChat "opchat.org")
(Openprojects "openprojects.net")
(Othernet "othernet.org")
@ -737,12 +739,12 @@ search for a match in `erc-networks-alist'."
(defun erc-network ()
"Return the value of `erc-network' for the current server."
(with-current-buffer (erc-server-buffer) erc-network))
(erc-with-server-buffer erc-network))
(defun erc-current-network ()
"Deprecated. Use `erc-network' instead. Return the name of this server's
network as a symbol."
(with-current-buffer (erc-server-buffer)
(erc-with-server-buffer
(intern (downcase (symbol-name erc-network)))))
(erc-make-obsolete 'erc-current-network 'erc-network
@ -750,7 +752,7 @@ network as a symbol."
(defun erc-network-name ()
"Returns the name of the current network as a string."
(with-current-buffer (erc-server-buffer) (symbol-name erc-network)))
(erc-with-server-buffer (symbol-name erc-network)))
(defun erc-set-network-name (proc parsed)
"Set `erc-network' to the value returned by `erc-determine-network'."

View file

@ -121,8 +121,7 @@ changes."
(ison-list (delete "" (split-string
(erc-response.contents parsed))))
(new-list ison-list)
(old-list (with-current-buffer (erc-server-buffer)
erc-last-ison)))
(old-list (erc-with-server-buffer erc-last-ison)))
(while new-list
(when (not (erc-member-ignore-case (car new-list) old-list))
(run-hook-with-args 'erc-notify-signon-hook server (car new-list))
@ -204,7 +203,7 @@ with args, toggle notify status of people."
(cond
((null args)
;; Print current notificated people (online)
(let ((ison (with-current-buffer (erc-server-buffer) erc-last-ison)))
(let ((ison (erc-with-server-buffer erc-last-ison)))
(if (not ison)
(erc-display-message
nil 'notice 'active "No ison-list yet!")

View file

@ -180,7 +180,7 @@ the most recent speakers are listed first."
(while (pcomplete-here (pcomplete-erc-nicks))))
(defun pcomplete/erc-mode/UNIGNORE ()
(pcomplete-here (with-current-buffer (erc-server-buffer) erc-ignore-list)))
(pcomplete-here (erc-with-server-buffer erc-ignore-list)))
;;; Functions that provide possible completions.
@ -233,7 +233,7 @@ If optional argument IGNORE-SELF is non-nil, don't return the current nick."
(defun pcomplete-erc-all-nicks (&optional postfix)
"Returns a list of all nicks on the current server."
(let (nicks)
(with-current-buffer (process-buffer erc-server-process)
(erc-with-server-buffer
(maphash (lambda (nick user)
(setq nicks (cons (concat nick postfix) nicks)))
erc-server-users))

View file

@ -1,6 +1,7 @@
;; erc-ring.el -- Command history handling for erc using ring.el
;; Copyright (C) 2001, 2002, 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
;; Copyright (C) 2001, 2002, 2003, 2004, 2006,
;; 2007 Free Software Foundation, Inc.
;; Author: Alex Schroeder <alex@gnu.org>
;; Keywords: comm

View file

@ -168,15 +168,18 @@ Example of use:
:type '(repeat
(list :tag "Network"
(choice :tag "Network name"
(const freenode)
(const OFTC)
(const DALnet)
(const GalaxyNet)
(const SlashNET)
(const BRASnet)
(const iip)
(const Ars)
(const Austnet)
(const Azzurra)
(const BitlBee)
(const BRASnet)
(const DALnet)
(const freenode)
(const GalaxyNet)
(const iip)
(const OFTC)
(const QuakeNet)
(const SlashNET)
(symbol :tag "Network name"))
(repeat :tag "Nickname and password"
(cons :tag "Identity"
@ -186,68 +189,63 @@ Example of use:
;; Variables:
(defcustom erc-nickserv-alist
'((BitlBee
nil
nil
"&bitlbee"
"identify"
nil)
(DALnet
"NickServ!service@dal.net"
"/msg\\s-NickServ@services.dal.net\\s-IDENTIFY\\s-<password>"
"NickServ@services.dal.net"
"IDENTIFY"
nil)
(freenode
"NickServ!NickServ@services."
"/msg\\s-NickServ\\s-IDENTIFY\\s-<password>"
"NickServ"
"IDENTIFY"
nil)
(GalaxyNet
"NS!nickserv@galaxynet.org"
"Please\\s-change\\s-nicks\\s-or\\s-authenticate."
"NS@services.galaxynet.org"
"AUTH"
t)
(SlashNET
"NickServ!services@services.slashnet.org"
"/msg\\s-NickServ\\s-IDENTIFY\\s-password"
"NickServ@services.slashnet.org"
"IDENTIFY"
nil)
(iip
"Trent@anon.iip"
"type\\s-/squery\\s-Trent\\s-identify\\s-<password>"
"Trent@anon.iip"
"IDENTIFY"
nil
"SQUERY")
(BRASnet
"NickServ!services@brasnet.org"
"/NickServ\\s-IDENTIFY\\s-senha"
"NickServ"
"IDENTIFY"
nil
"")
'((Ars
nil nil
"Census"
"IDENTIFY" nil nil)
(Austnet
"NickOP!service@austnet.org"
"/msg\\s-NickOP@austnet.org\\s-identify\\s-<password>"
"nickop@austnet.org"
"identify"
nil)
"identify" nil nil)
(Azzurra
"NickServ!service@azzurra.org"
"/ns\\s-IDENTIFY\\s-password"
"NickServ"
"IDENTIFY"
nil)
"IDENTIFY" nil nil)
(BitlBee
nil nil
"&bitlbee"
"identify" nil nil)
(BRASnet
"NickServ!services@brasnet.org"
"/NickServ\\s-IDENTIFY\\s-senha"
"NickServ"
"IDENTIFY" nil "")
(DALnet
"NickServ!service@dal.net"
"/msg\\s-NickServ@services.dal.net\\s-IDENTIFY\\s-<password>"
"NickServ@services.dal.net"
"IDENTIFY" nil nil)
(freenode
"NickServ!NickServ@services."
"/msg\\s-NickServ\\s-IDENTIFY\\s-<password>"
"NickServ"
"IDENTIFY" nil nil)
(GalaxyNet
"NS!nickserv@galaxynet.org"
"Please\\s-change\\s-nicks\\s-or\\s-authenticate."
"NS@services.galaxynet.org"
"AUTH" t nil)
(iip
"Trent@anon.iip"
"type\\s-/squery\\s-Trent\\s-identify\\s-<password>"
"Trent@anon.iip"
"IDENTIFY" nil "SQUERY")
(OFTC
"NickServ!services@services.oftc.net"
"/msg\\s-NickServ\\s-IDENTIFY\\s-\^_password"
"type\\s-/msg\\s-NickServ\\s-IDENTIFY\\s-password."
"NickServ"
"IDENTIFY"
nil))
"IDENTIFY" nil nil)
(QuakeNet
nil nil
"Q@CServe.quakenet.org"
"auth" t nil)
(SlashNET
"NickServ!services@services.slashnet.org"
"/msg\\s-NickServ\\s-IDENTIFY\\s-password"
"NickServ@services.slashnet.org"
"IDENTIFY" nil nil))
"Alist of NickServer details, sorted by network.
Every element in the list has the form
\(SYMBOL NICKSERV REGEXP NICK KEYWORD USE-CURRENT ANSWER)
@ -265,8 +263,10 @@ ANSWER is the command to use for the answer. The default is 'privmsg.
:type '(repeat
(list :tag "Nickserv data"
(symbol :tag "Network name")
(string :tag "Nickserv's nick!user@host")
(regexp :tag "Identify request sent by Nickserv")
(choice (string :tag "Nickserv's nick!user@host")
(const :tag "No message sent by Nickserv" nil))
(choice (regexp :tag "Identify request sent by Nickserv")
(const :tag "No message sent by Nickserv" nil))
(string :tag "Identify to")
(string :tag "Identify keyword")
(boolean :tag "Use current nick in identify message?")

View file

@ -1,6 +1,7 @@
;;; erc-speedbar.el --- Speedbar support for ERC
;; Copyright (C) 2001, 2002, 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
;; Copyright (C) 2001, 2002, 2003, 2004, 2006,
;; 2007 Free Software Foundation, Inc.
;; Author: Mario Lang <mlang@delysid.org>
;; Contributor: Eric M. Ludlam <eric@siege-engine.com>
@ -113,7 +114,7 @@ This will add a speedbar major display mode."
(erase-buffer)
(let (serverp chanp queryp)
(with-current-buffer buffer
(setq serverp (eq buffer (process-buffer erc-server-process)))
(setq serverp (erc-server-buffer-p))
(setq chanp (erc-channel-p (erc-default-target)))
(setq queryp (erc-query-buffer-p)))
(cond (serverp

View file

@ -41,12 +41,10 @@
;; called AFTER the server buffer is initialized.
((add-hook 'erc-connect-pre-hook 'erc-spelling-init)
(dolist (buffer (erc-buffer-list))
(when (buffer-live-p buffer)
(with-current-buffer buffer (erc-spelling-init)))))
(erc-spelling-init buffer)))
((remove-hook 'erc-connect-pre-hook 'erc-spelling-init)
(dolist (buffer (erc-buffer-list))
(when (buffer-live-p buffer)
(with-current-buffer buffer (flyspell-mode 0))))))
(with-current-buffer buffer (flyspell-mode 0)))))
(defcustom erc-spelling-dictionaries nil
"An alist mapping buffer names to dictionaries.
@ -60,24 +58,22 @@ name here."
(string :tag "Dictionary"))))
:group 'erc-spelling)
(defun erc-spelling-init ()
"Enable flyspell mode in an ERC buffer."
(let ((name (downcase (buffer-name)))
(dicts erc-spelling-dictionaries))
(when dicts
(while (and dicts
(not (string= name (downcase (caar dicts)))))
(setq dicts (cdr dicts)))
(setq ispell-local-dictionary
(if dicts
(cadr (car dicts))
(let ((server (erc-server-buffer)))
(if server
(with-current-buffer server
ispell-local-dictionary)
nil))))))
(setq flyspell-generic-check-word-p 'erc-spelling-flyspell-verify)
(flyspell-mode 1))
(defun erc-spelling-init (buffer)
"Enable flyspell mode in an ERC buffer.
The current buffer is given by BUFFER."
(with-current-buffer buffer
(let ((name (downcase (buffer-name)))
(dicts erc-spelling-dictionaries))
(when dicts
(while (and dicts
(not (string= name (downcase (caar dicts)))))
(setq dicts (cdr dicts)))
(setq ispell-local-dictionary
(if dicts
(cadr (car dicts))
(erc-with-server-buffer ispell-local-dictionary)))))
(setq flyspell-generic-check-word-p 'erc-spelling-flyspell-verify)
(flyspell-mode 1)))
(defun erc-spelling-unhighlight-word (word)
"Unhighlight the given WORD.

View file

@ -147,7 +147,7 @@ or `erc-send-modify-hook'."
(error "Timestamp function unbound"))
(when (and (fboundp erc-insert-away-timestamp-function)
erc-away-timestamp-format
(with-current-buffer (erc-server-buffer) erc-away)
(erc-away-time)
(not erc-timestamp-format))
(funcall erc-insert-away-timestamp-function
(erc-format-timestamp ct erc-away-timestamp-format)))
@ -203,6 +203,7 @@ space before a right timestamp in any saved logs."
(s (if ignore-p (make-string len ? ) string)))
(unless ignore-p (setq erc-timestamp-last-inserted string))
(erc-put-text-property 0 len 'field 'erc-timestamp s)
(erc-put-text-property 0 len 'invisible 'timestamp s)
(insert s)))
(defun erc-insert-aligned (string pos)
@ -319,6 +320,21 @@ set, and timestamping is already active."
(setq erc-hide-timestamps nil)
(erc-munge-invisibility-spec))
(defun erc-toggle-timestamps ()
"Hide or show timestamps in ERC buffers.
Note that timestamps can only be shown for a message using this
function if `erc-timestamp-format' was set and timestamping was
enabled when the message was inserted."
(interactive)
(if erc-hide-timestamps
(setq erc-hide-timestamps nil)
(setq erc-hide-timestamps t))
(mapc (lambda (buffer)
(with-current-buffer buffer
(erc-munge-invisibility-spec)))
(erc-buffer-list)))
(defun erc-echo-timestamp (before now)
"Print timestamp text-property of an IRC message.
Argument BEFORE is where point was before it got moved and

View file

@ -1,6 +1,7 @@
;;; erc-track.el --- Track modified channel buffers
;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
;; Copyright (C) 2002, 2003, 2004, 2005, 2006,
;; 2007 Free Software Foundation, Inc.
;; Author: Mario Lang <mlang@delysid.org>
;; Keywords: comm, faces
@ -46,12 +47,33 @@
"Track active buffers and show activity in the modeline."
:group 'erc)
(defcustom erc-track-enable-keybindings 'ask
"Whether to enable the ERC track keybindings, namely:
`C-c C-SPC' and `C-c C-@', which both do the same thing.
The default is to check to see whether these keys are used
already: if not, then enable the ERC track minor mode, which
provides these keys. Otherwise, do not touch the keys.
This can alternatively be set to either t or nil, which indicate
respectively always to enable ERC track minor mode or never to
enable ERC track minor mode.
The reason for using this default value is to both (1) adhere to
the Emacs development guidelines which say not to touch keys of
the form C-c C-<something> and also (2) to meet the expectations
of long-time ERC users, many of whom rely on these keybindings."
:group 'erc-track
:type '(choice (const :tag "Ask, if used already" ask)
(const :tag "Enable" t)
(const :tag "Disable" nil)))
(defcustom erc-track-visibility t
"Where do we look for buffers to determine their visibility?
The value of this variable determines, when a buffer is considered
visible or invisible. New messages in invisible buffers are tracked,
while switching to visible buffers when they are tracked removes them
from the list. See also `erc-track-when-inactive-mode'.
from the list. See also `erc-track-when-inactive'.
Possible values are:
@ -488,45 +510,124 @@ START is the minimum length of the name used."
(equal (erc-unique-substrings '("abc" "abcdefg"))
'("abc" "abcd"))))))
;;; Minor mode
;; Play nice with other IRC clients (and Emacs development rules) by
;; making this a minor mode
(defvar erc-track-minor-mode-map (make-sparse-keymap)
"Keymap for rcirc track minor mode.")
(define-key erc-track-minor-mode-map (kbd "C-c C-@") 'erc-track-switch-buffer)
(define-key erc-track-minor-mode-map (kbd "C-c C-SPC")
'erc-track-switch-buffer)
;;;###autoload
(define-minor-mode erc-track-minor-mode
"Global minor mode for tracking ERC buffers and showing activity in the
mode line.
This exists for the sole purpose of providing the C-c C-SPC and
C-c C-@ keybindings. Make sure that you have enabled the track
module, otherwise the keybindings will not do anything useful."
:init-value nil
:lighter ""
:keymap erc-track-minor-mode-map
:global t
:group 'erc-track)
(defun erc-track-minor-mode-maybe ()
"Enable `erc-track-minor-mode', depending on `erc-track-enable-keybindings'."
(unless (or erc-track-minor-mode
;; don't start the minor mode until we have an ERC
;; process running, because we don't want to prompt the
;; user while starting Emacs
(null (erc-buffer-list)))
(cond ((eq erc-track-enable-keybindings 'ask)
(let ((key (or (and (key-binding (kbd "C-c C-SPC")) "C-SPC")
(and (key-binding (kbd "C-c C-@")) "C-@"))))
(if key
(if (y-or-n-p
(concat "The C-c " key " binding is in use;"
" override it for tracking? "))
(progn
(message (concat "Will change it; set"
" `erc-track-enable-keybindings'"
" to disable this message"))
(sleep-for 3)
(erc-track-minor-mode 1))
(message (concat "Not changing it; set"
" `erc-track-enable-keybindings'"
" to disable this message"))
(sleep-for 3))
(erc-track-minor-mode 1))))
((eq erc-track-enable-keybindings t)
(erc-track-minor-mode 1))
(t nil))))
;;; Module
;;;###autoload (autoload 'erc-track-mode "erc-track" nil t)
(define-erc-module track track-modified-channels
(define-erc-module track nil
"This mode tracks ERC channel buffers with activity."
((erc-track-add-to-mode-line erc-track-position-in-mode-line)
(setq erc-modified-channels-object (erc-modified-channels-object nil))
(erc-update-mode-line)
(if (featurep 'xemacs)
(defadvice switch-to-buffer (after erc-update (&rest args) activate)
(erc-modified-channels-update))
(add-hook 'window-configuration-change-hook 'erc-modified-channels-update))
(add-hook 'erc-insert-post-hook 'erc-track-modified-channels)
(add-hook 'erc-disconnected-hook 'erc-modified-channels-update))
((erc-track-remove-from-mode-line)
(if (featurep 'xemacs)
(ad-disable-advice 'switch-to-buffer 'after 'erc-update)
(remove-hook 'window-configuration-change-hook
'erc-modified-channels-update))
(remove-hook 'erc-disconnected-hook 'erc-modified-channels-update)
(remove-hook 'erc-insert-post-hook 'erc-track-modified-channels)))
;; Enable:
((when (boundp 'erc-track-when-inactive)
(if erc-track-when-inactive
(progn
(if (featurep 'xemacs)
(defadvice switch-to-buffer (after erc-update-when-inactive
(&rest args) activate)
(erc-user-is-active))
(add-hook 'window-configuration-change-hook 'erc-user-is-active))
(add-hook 'erc-send-completed-hook 'erc-user-is-active)
(add-hook 'erc-server-001-functions 'erc-user-is-active))
(erc-track-add-to-mode-line erc-track-position-in-mode-line)
(setq erc-modified-channels-object (erc-modified-channels-object nil))
(erc-update-mode-line)
(if (featurep 'xemacs)
(defadvice switch-to-buffer (after erc-update (&rest args) activate)
(erc-modified-channels-update))
(add-hook 'window-configuration-change-hook
'erc-modified-channels-update))
(add-hook 'erc-insert-post-hook 'erc-track-modified-channels)
(add-hook 'erc-disconnected-hook 'erc-modified-channels-update))
;; enable the tracking keybindings
(erc-track-minor-mode-maybe)))
;; Disable:
((when (boundp 'erc-track-when-inactive)
(erc-track-remove-from-mode-line)
(if erc-track-when-inactive
(progn
(if (featurep 'xemacs)
(ad-disable-advice 'switch-to-buffer 'after
'erc-update-when-inactive)
(remove-hook 'window-configuration-change-hook
'erc-user-is-active))
(remove-hook 'erc-send-completed-hook 'erc-user-is-active)
(remove-hook 'erc-server-001-functions 'erc-user-is-active)
(remove-hook 'erc-timer-hook 'erc-user-is-active))
(if (featurep 'xemacs)
(ad-disable-advice 'switch-to-buffer 'after 'erc-update)
(remove-hook 'window-configuration-change-hook
'erc-modified-channels-update))
(remove-hook 'erc-disconnected-hook 'erc-modified-channels-update)
(remove-hook 'erc-insert-post-hook 'erc-track-modified-channels))
;; disable the tracking keybindings
(when erc-track-minor-mode
(erc-track-minor-mode -1)))))
;;;###autoload (autoload 'erc-track-when-inactive-mode "erc-track" nil t)
(define-erc-module track-when-inactive nil
"This mode enables channel tracking even for visible buffers,
if you are inactivity."
((if (featurep 'xemacs)
(defadvice switch-to-buffer (after erc-update-when-inactive (&rest args) activate)
(erc-user-is-active))
(add-hook 'window-configuration-change-hook 'erc-user-is-active))
(add-hook 'erc-send-completed-hook 'erc-user-is-active)
(add-hook 'erc-server-001-functions 'erc-user-is-active))
((erc-track-remove-from-mode-line)
(if (featurep 'xemacs)
(ad-disable-advice 'switch-to-buffer 'after 'erc-update-when-inactive)
(remove-hook 'window-configuration-change-hook 'erc-user-is-active))
(remove-hook 'erc-send-completed-hook 'erc-user-is-active)
(remove-hook 'erc-server-001-functions 'erc-user-is-active)
(remove-hook 'erc-timer-hook 'erc-user-is-active)))
(defcustom erc-track-when-inactive nil
"Enable channel tracking even for visible buffers, if you are
inactive."
:group 'erc-track
:type 'boolean
:set (lambda (sym val)
(if erc-track-mode
(progn
(erc-track-disable)
(set sym val)
(erc-track-enable))
(set sym val))))
;;; Visibility
@ -545,7 +646,7 @@ only consider active buffers visible.")
(defun erc-buffer-visible (buffer)
"Return non-nil when the buffer is visible."
(if erc-track-when-inactive-mode
(if erc-track-when-inactive
(when erc-buffer-activity; could be nil
(and (get-buffer-window buffer erc-track-visibility)
(<= (erc-time-diff erc-buffer-activity (erc-current-time))
@ -815,7 +916,9 @@ relative to `erc-track-switch-direction'"
switch back to the last non-ERC buffer visited. Next is defined by
`erc-track-switch-direction', a negative argument will reverse this."
(interactive "p")
(when erc-track-mode
(if (not erc-track-mode)
(message (concat "Enable the ERC track module if you want to use the"
" tracking minor mode"))
(cond (erc-modified-channels-alist
;; if we're not in erc-mode, set this buffer to return to
(unless (eq major-mode 'erc-mode)
@ -828,12 +931,6 @@ switch back to the last non-ERC buffer visited. Next is defined by
(buffer-live-p erc-track-last-non-erc-buffer))
(switch-to-buffer erc-track-last-non-erc-buffer)))))
;; These bindings are global, because they pop us from any other
;; buffer to an active ERC buffer!
(global-set-key (kbd "C-c C-@") 'erc-track-switch-buffer)
(global-set-key (kbd "C-c C-SPC") 'erc-track-switch-buffer)
(provide 'erc-track)
;;; erc-track.el ends here

View file

@ -66,7 +66,7 @@
;;; Code:
(defconst erc-version-string "Version 5.2 stable pre-release"
(defconst erc-version-string "Version 5.2"
"ERC version. This is used by function `erc-version'.")
(eval-when-compile (require 'cl))
@ -324,7 +324,7 @@ Each function should accept two arguments, NEW-NICK and OLD-NICK."
(defcustom erc-connect-pre-hook '(erc-initialize-log-marker)
"Hook called just before `erc' calls `erc-connect'.
Functions are run in the buffer-to-be."
Functions are passed a buffer as the first argument."
:group 'erc-hooks
:type 'hook)
@ -392,14 +392,14 @@ in the current buffer's `erc-channel-users' hash table."
(defsubst erc-get-server-user (nick)
"Finds the USER corresponding to NICK in the current server's
`erc-server-users' hash table."
(with-current-buffer (process-buffer erc-server-process)
(erc-with-server-buffer
(gethash (erc-downcase nick) erc-server-users)))
(defsubst erc-add-server-user (nick user)
"This function is for internal use only.
Adds USER with nickname NICK to the `erc-server-users' hash table."
(with-current-buffer (process-buffer erc-server-process)
(erc-with-server-buffer
(puthash (erc-downcase nick) user erc-server-users)))
(defsubst erc-remove-server-user (nick)
@ -410,7 +410,7 @@ hash table. This user is not removed from the
`erc-channel-users' lists of other buffers.
See also: `erc-remove-user'."
(with-current-buffer (process-buffer erc-server-process)
(erc-with-server-buffer
(remhash (erc-downcase nick) erc-server-users)))
(defun erc-change-user-nickname (user new-nick)
@ -421,7 +421,7 @@ Changes the nickname of USER to NEW-NICK in the
other buffers are also changed."
(let ((nick (erc-server-user-nickname user)))
(setf (erc-server-user-nickname user) new-nick)
(with-current-buffer (process-buffer erc-server-process)
(erc-with-server-buffer
(remhash (erc-downcase nick) erc-server-users)
(puthash (erc-downcase new-nick) user erc-server-users))
(dolist (buf (erc-server-user-buffers user))
@ -514,16 +514,15 @@ See also: `erc-sort-channel-users-by-activity'"
(defun erc-get-server-nickname-list ()
"Returns a list of known nicknames on the current server."
(if (erc-server-process-alive)
(with-current-buffer (erc-server-buffer)
(let (nicks)
(when (hash-table-p erc-server-users)
(maphash (lambda (n user)
(setq nicks
(cons (erc-server-user-nickname user)
nicks)))
erc-server-users)
nicks)))))
(erc-with-server-buffer
(let (nicks)
(when (hash-table-p erc-server-users)
(maphash (lambda (n user)
(setq nicks
(cons (erc-server-user-nickname user)
nicks)))
erc-server-users)
nicks))))
(defun erc-get-channel-nickname-list ()
"Returns a list of known nicknames on the current channel."
@ -538,16 +537,15 @@ See also: `erc-sort-channel-users-by-activity'"
(defun erc-get-server-nickname-alist ()
"Returns an alist of known nicknames on the current server."
(if (erc-server-process-alive)
(with-current-buffer (erc-server-buffer)
(let (nicks)
(when (hash-table-p erc-server-users)
(maphash (lambda (n user)
(setq nicks
(cons (cons (erc-server-user-nickname user) nil)
nicks)))
erc-server-users)
nicks)))))
(erc-with-server-buffer
(let (nicks)
(when (hash-table-p erc-server-users)
(maphash (lambda (n user)
(setq nicks
(cons (cons (erc-server-user-nickname user) nil)
nicks)))
erc-server-users)
nicks))))
(defun erc-get-channel-nickname-alist ()
"Returns an alist of known nicknames on the current channel."
@ -1293,7 +1291,7 @@ capabilities."
(unless (erc-server-buffer-p)
(error
"You should only run `erc-once-with-server-event' in a server buffer"))
(let ((fun (erc-gensym))
(let ((fun (make-symbol "fun"))
(hook (erc-get-hook event)))
(put fun 'erc-original-buffer (current-buffer))
(fset fun `(lambda (proc parsed)
@ -1316,7 +1314,7 @@ not be run.
When FORMS execute, the current buffer is the server buffer associated with the
connection over which the data was received that triggered EVENT."
(let ((fun (erc-gensym))
(let ((fun (make-symbol "fun"))
(hook (erc-get-hook event)))
(fset fun `(lambda (proc parsed)
(remove-hook ',hook ',fun)
@ -1370,7 +1368,7 @@ If BUFFER is nil, the current buffer is used."
(defun erc-ison-p (nick)
"Return non-nil if NICK is online."
(interactive "sNick: ")
(with-current-buffer (erc-server-buffer)
(erc-with-server-buffer
(let ((erc-online-p 'unknown))
(erc-once-with-server-event
303
@ -1420,7 +1418,7 @@ server buffer.")
(defun erc-active-buffer ()
"Return the value of `erc-active-buffer' for the current server.
Defaults to the server buffer."
(with-current-buffer (erc-server-buffer)
(erc-with-server-buffer
(if (buffer-live-p erc-active-buffer)
erc-active-buffer
(setq erc-active-buffer (current-buffer)))))
@ -1603,10 +1601,10 @@ See `erc-get-buffer' for details.
See also `with-current-buffer'.
\(fn (TARGET [PROCESS]) BODY...)"
(let ((buf (erc-gensym))
(proc (erc-gensym))
(target (erc-gensym))
(process (erc-gensym)))
(let ((buf (make-symbol "buf"))
(proc (make-symbol "proc"))
(target (make-symbol "target"))
(process (make-symbol "process")))
`(let* ((,target ,(car spec))
(,process ,(cadr spec))
(,buf (if (bufferp ,target)
@ -1616,7 +1614,7 @@ See also `with-current-buffer'.
erc-server-process))))
(if (and ,target ,proc)
(erc-get-buffer ,target ,proc))))))
(when ,buf
(when (buffer-live-p ,buf)
(with-current-buffer ,buf
,@body)))))
(put 'erc-with-buffer 'lisp-indent-function 1)
@ -1671,8 +1669,8 @@ FORMS will be evaluated in all buffers having the process PROCESS and
where PRED matches or in all buffers of the server process if PRED is
nil."
;; Make the evaluation have the correct order
(let ((pre (erc-gensym))
(pro (erc-gensym)))
(let ((pre (make-symbol "pre"))
(pro (make-symbol "pro")))
`(let ((,pro ,process)
(,pre ,pred))
(mapcar (lambda (buffer)
@ -1755,7 +1753,10 @@ all channel buffers on all servers."
(make-variable-buffer-local 'erc-invitation)
(defvar erc-away nil
"Non-nil indicates that we are away.")
"Non-nil indicates that we are away.
Use `erc-away-time' to access this if you might be in a channel
buffer rather than a server buffer.")
(make-variable-buffer-local 'erc-away)
(defvar erc-channel-list nil
@ -1813,43 +1814,43 @@ removed from the list will be disabled."
:type
'(set
:greedy t
(const :tag "Set away status automatically" autoaway)
(const :tag "Join channels automatically" autojoin)
(const :tag "Buttonize URLs, nicknames, and other text" button)
(const
:tag
"Mark unidentified users on freenode and other servers supporting CAPAB"
capab-identify)
(const :tag "Wrap long lines" fill)
(const :tag "Launch an identd server on port 8113" identd)
(const :tag "Highlight or remove IRC control characters"
irccontrols)
(const :tag "Save buffers in logs" log)
(const :tag "Highlight pals, fools, and other keywords" match)
(const :tag "Display a menu in ERC buffers" menu)
(const :tag "Detect netsplits" netsplit)
(const :tag "Don't display non-IRC commands after evaluation"
noncommands)
(const :tag "Notify when the online status of certain users changes"
notify)
(const :tag "Complete nicknames and commands (programmable)"
(const :tag "autoaway: Set away status automatically" autoaway)
(const :tag "autojoin: Join channels automatically" autojoin)
(const :tag "button: Buttonize URLs, nicknames, and other text" button)
(const :tag "capab: Mark unidentified users on servers supporting CAPAB"
capab-identify)
(const :tag "completion: Complete nicknames and commands (programmable)"
completion)
(const :tag "Complete nicknames and commands (old)" hecomplete)
(const :tag "Process CTCP PAGE requests from IRC" page)
(const :tag "Make displayed lines read-only" readonly)
(const :tag "Replace text in messages" replace)
(const :tag "Enable an input history" ring)
(const :tag "Scroll to the bottom of the buffer" scrolltobottom)
(const :tag "Identify to Nickserv (IRC Services) automatically"
(const :tag "hecomplete: Complete nicknames and commands (old)" hecomplete)
(const :tag "fill: Wrap long lines" fill)
(const :tag "identd: Launch an identd server on port 8113" identd)
(const :tag "irccontrols: Highlight or remove IRC control characters"
irccontrols)
(const :tag "log: Save buffers in logs" log)
(const :tag "match: Highlight pals, fools, and other keywords" match)
(const :tag "menu: Display a menu in ERC buffers" menu)
(const :tag "netsplit: Detect netsplits" netsplit)
(const :tag "noncommands: Don't display non-IRC commands after evaluation"
noncommands)
(const :tag
"notify: Notify when the online status of certain users changes"
notify)
(const :tag "page: Process CTCP PAGE requests from IRC" page)
(const :tag "readonly: Make displayed lines read-only" readonly)
(const :tag "replace: Replace text in messages" replace)
(const :tag "ring: Enable an input history" ring)
(const :tag "scrolltobottom: Scroll to the bottom of the buffer"
scrolltobottom)
(const :tag "services: Identify to Nickserv (IRC Services) automatically"
services)
(const :tag "Convert smileys to pretty icons" smiley)
(const :tag "Play sounds when you receive CTCP SOUND requests"
(const :tag "smiley: Convert smileys to pretty icons" smiley)
(const :tag "sound: Play sounds when you receive CTCP SOUND requests"
sound)
(const :tag "Add timestamps to messages" stamp)
(const :tag "Check spelling" spelling)
(const :tag "Track channel activity in the mode-line" track)
(const :tag "Truncate buffers to a certain size" truncate)
(const :tag "Translate morse code in messages" unmorse)
(const :tag "stamp: Add timestamps to messages" stamp)
(const :tag "spelling: Check spelling" spelling)
(const :tag "track: Track channel activity in the mode-line" track)
(const :tag "truncate: Truncate buffers to a certain size" truncate)
(const :tag "unmorse: Translate morse code in messages" unmorse)
(repeat :tag "Others" :inline t symbol))
:group 'erc)
@ -1902,9 +1903,7 @@ removed from the list will be disabled."
(defun erc-open (&optional server port nick full-name
connect passwd tgt-list channel process)
"ERC is a powerful, modular, and extensible IRC client.
Connect to SERVER on PORT as NICK with FULL-NAME.
"Connect to SERVER on PORT as NICK with FULL-NAME.
If CONNECT is non-nil, connect to the server. Otherwise assume
already connected and just create a separate buffer for the new
@ -1969,10 +1968,6 @@ Returns the buffer for the given server or channel."
(erc-set-active-buffer buffer)
;; last invitation channel
(setq erc-invitation nil)
;; away flag
;; Should only be used in session-buffers
(setq erc-away (let ((serverbuf (erc-server-buffer)))
(and serverbuf (with-current-buffer serverbuf erc-away))))
;; Server channel list
(setq erc-channel-list ())
;; login-time 'nick in use' error
@ -1987,25 +1982,25 @@ Returns the buffer for the given server or channel."
(setq erc-dbuf
(when erc-log-p
(get-buffer-create (concat "*ERC-DEBUG: " server "*"))))
(erc-determine-parameters server port nick full-name)
;; Saving log file on exit
(run-hooks 'erc-connect-pre-hook)
(when connect
(erc-server-connect erc-session-server erc-session-port))
(erc-update-mode-line)
(set-marker erc-insert-marker (point))
;; set up prompt
(unless continued-session
(goto-char (point-max))
(insert "\n"))
(set-marker (process-mark erc-server-process) (point))
(if continued-session
(goto-char old-point)
(set-marker erc-insert-marker (point))
(erc-display-prompt)
(goto-char (point-max)))
(erc-determine-parameters server port nick full-name)
;; Saving log file on exit
(run-hook-with-args 'erc-connect-pre-hook buffer)
(when connect
(erc-server-connect erc-session-server erc-session-port buffer))
(erc-update-mode-line)
;; Now display the buffer in a window as per user wishes.
(unless (eq buffer old-buffer)
(when erc-log-p
@ -2016,11 +2011,13 @@ Returns the buffer for the given server or channel."
buffer))
(defun erc-initialize-log-marker ()
"Initialize the `erc-last-saved-position' marker to a sensible position."
(defun erc-initialize-log-marker (buffer)
"Initialize the `erc-last-saved-position' marker to a sensible position.
BUFFER is the current buffer."
(with-current-buffer buffer
(setq erc-last-saved-position (make-marker))
(move-marker erc-last-saved-position
(1- (marker-position erc-insert-marker))))
(1- (marker-position erc-insert-marker)))))
;; interactive startup
@ -2120,8 +2117,12 @@ functions in here get called with the parameters SERVER and NICK."
(nick (erc-compute-nick))
password
(full-name (erc-compute-full-name)))
"Select connection parameters and run ERC.
Non-interactively, it takes keyword arguments
"ERC is a powerful, modular, and extensible IRC client.
This function is the main entry point for ERC.
It permits you to select connection parameters, and then starts ERC.
Non-interactively, it takes the keyword arguments
(server (erc-compute-server))
(port (erc-compute-port))
(nick (erc-compute-nick))
@ -2132,12 +2133,13 @@ That is, if called with
(erc :server \"irc.freenode.net\" :full-name \"Harry S Truman\")
server and full-name will be set to those values, whereas
then the server and full-name will be set to those values, whereas
`erc-compute-port', `erc-compute-nick' and `erc-compute-full-name' will
be invoked for the values of the other parameters."
(interactive (erc-select-read-args))
(erc-open server port nick full-name t password))
;;;###autoload
(defalias 'erc-select 'erc)
(defun erc-ssl (&rest r)
@ -2428,7 +2430,7 @@ See also `erc-format-message' and `erc-display-line'."
This function relies on the erc-parsed text-property being
present."
(let ((prop-val (get-text-property position 'erc-parsed)))
(let ((prop-val (erc-get-parsed-vector position)))
(and prop-val (member (erc-response.command prop-val) list))))
(defvar erc-send-input-line-function 'erc-send-input-line)
@ -2586,20 +2588,19 @@ If no USER argument is specified, list the contents of `erc-ignore-list'."
(erc-display-line
(erc-make-notice (format "Now ignoring %s" user))
'active)
(with-current-buffer (erc-server-buffer)
(add-to-list 'erc-ignore-list user)))
(if (null (with-current-buffer (erc-server-buffer) erc-ignore-list))
(erc-with-server-buffer (add-to-list 'erc-ignore-list user)))
(if (null (erc-with-server-buffer erc-ignore-list))
(erc-display-line (erc-make-notice "Ignore list is empty") 'active)
(erc-display-line (erc-make-notice "Ignore list:") 'active)
(mapc #'(lambda (item)
(erc-display-line (erc-make-notice item)
'active))
(with-current-buffer (erc-server-buffer) erc-ignore-list))))
(erc-with-server-buffer erc-ignore-list))))
t)
(defun erc-cmd-UNIGNORE (user)
"Remove the user specified in USER from the ignore list."
(let ((ignored-nick (car (with-current-buffer (erc-server-buffer)
(let ((ignored-nick (car (erc-with-server-buffer
(erc-member-ignore-case (regexp-quote user)
erc-ignore-list)))))
(unless ignored-nick
@ -2614,7 +2615,7 @@ If no USER argument is specified, list the contents of `erc-ignore-list'."
(erc-display-line
(erc-make-notice (format "No longer ignoring %s" user))
'active)
(with-current-buffer (erc-server-buffer)
(erc-with-server-buffer
(setq erc-ignore-list (delete ignored-nick erc-ignore-list)))))
t)
@ -2673,8 +2674,8 @@ If no reason is given, unset away status."
"Mark the user as being away everywhere, the reason being indicated by LINE."
;; on all server buffers.
(erc-with-all-buffers-of-server nil
#'erc-server-buffer-p
(erc-cmd-AWAY line)))
#'erc-open-server-buffer-p
(erc-cmd-AWAY line)))
(put 'erc-cmd-GAWAY 'do-not-parse-args t)
(defun erc-cmd-CTCP (nick cmd &rest args)
@ -2866,10 +2867,9 @@ If SERVER is non-nil, use that, rather than the current server."
(defun erc-cmd-IDLE (nick)
"Show the length of time NICK has been idle."
(let ((serverbuf (erc-server-buffer))
(origbuf (current-buffer))
(let ((origbuf (current-buffer))
symlist)
(with-current-buffer serverbuf
(erc-with-server-buffer
(add-to-list 'symlist
(cons (erc-once-with-server-event
311 `(string= ,nick
@ -3027,8 +3027,8 @@ The rest of LINE is the message to send."
(defun erc-cmd-NICK (nick)
"Change current nickname to NICK."
(erc-log (format "cmd: NICK: %s (erc-bad-nick: %S)" nick erc-bad-nick))
(let ((nicklen (cdr (assoc "NICKLEN" (with-current-buffer (erc-server-buffer)
erc-server-parameters)))))
(let ((nicklen (cdr (assoc "NICKLEN" (erc-with-server-buffer
erc-server-parameters)))))
(and nicklen (> (length nick) (string-to-number nicklen))
(erc-display-message
nil 'notice 'active 'nick-too-long
@ -3167,7 +3167,8 @@ the message given by REASON."
((string-match "^\\s-*\\(.*\\)$" reason)
(let* ((s (match-string 1 reason))
(buffer (erc-server-buffer))
(reason (funcall erc-quit-reason (if (equal s "") nil s))))
(reason (funcall erc-quit-reason (if (equal s "") nil s)))
server-proc)
(with-current-buffer (if (and buffer
(bufferp buffer))
buffer
@ -3175,10 +3176,18 @@ the message given by REASON."
(erc-log (format "cmd: QUIT: %s" reason))
(setq erc-server-quitting t)
(erc-set-active-buffer (erc-server-buffer))
(setq server-proc erc-server-process)
(erc-server-send (format "QUIT :%s" reason)))
(run-hook-with-args 'erc-quit-hook erc-server-process)
(run-hook-with-args 'erc-quit-hook server-proc)
(when erc-kill-queries-on-quit
(erc-kill-query-buffers erc-server-process)))
(erc-kill-query-buffers server-proc))
;; if the process has not been killed within 4 seconds, kill it
(run-at-time 4 nil
(lambda (proc)
(when (and (processp proc)
(memq (process-status proc) '(run open)))
(delete-process proc)))
server-proc))
t)
(t nil)))
@ -3189,9 +3198,7 @@ the message given by REASON."
(defun erc-cmd-GQUIT (reason)
"Disconnect from all servers at once with the same quit REASON."
(erc-with-all-buffers-of-server nil #'(lambda ()
(and (erc-server-buffer-p)
(erc-server-process-alive)))
(erc-with-all-buffers-of-server nil #'erc-open-server-buffer-p
(erc-cmd-QUIT reason)))
(defalias 'erc-cmd-GQ 'erc-cmd-GQUIT)
@ -3199,8 +3206,17 @@ the message given by REASON."
(defun erc-cmd-RECONNECT ()
"Try to reconnect to the current IRC server."
(setq erc-server-reconnect-count 0)
(erc-server-reconnect)
(let ((buffer (or (erc-server-buffer) (current-buffer)))
(process nil))
(with-current-buffer (if (bufferp buffer) buffer (current-buffer))
(setq erc-server-quitting nil)
(setq erc-server-reconnecting t)
(setq erc-server-reconnect-count 0)
(setq process (get-buffer-process (erc-server-buffer)))
(if process
(delete-process process)
(erc-server-reconnect))
(setq erc-server-reconnecting nil)))
t)
(defun erc-cmd-SERVER (server)
@ -3373,7 +3389,7 @@ The ban list is fetched from the server if necessary."
(setq erc-server-367-functions 'erc-banlist-store
erc-channel-banlist nil)
;; fetch the ban list then callback
(with-current-buffer (erc-server-buffer)
(erc-with-server-buffer
(erc-once-with-server-event
368
`(with-current-buffer ,chnl-name
@ -3443,7 +3459,7 @@ Unban all currently banned users in the current channel."
(let ((old-367-hook erc-server-367-functions))
(setq erc-server-367-functions 'erc-banlist-store)
;; fetch the ban list then callback
(with-current-buffer (erc-server-buffer)
(erc-with-server-buffer
(erc-once-with-server-event
368
`(with-current-buffer ,chnl
@ -3737,7 +3753,7 @@ To change how this query window is displayed, use `let' to bind
(erc-update-mode-line)
buf))
(defcustom erc-auto-query nil
(defcustom erc-auto-query 'bury
"If non-nil, create a query buffer each time you receive a private message.
If the buffer doesn't already exist it is created. This can be
@ -3811,7 +3827,7 @@ See also `erc-display-error-notice'."
(setq erc-nick-change-attempt-count (+ erc-nick-change-attempt-count 1))
(let ((newnick (nth 1 erc-default-nicks))
(nicklen (cdr (assoc "NICKLEN"
(with-current-buffer (erc-server-buffer)
(erc-with-server-buffer
erc-server-parameters)))))
(setq erc-bad-nick t)
;; try to use a different nick
@ -4101,24 +4117,29 @@ See also: `erc-echo-notice-in-user-buffers',
"Run just after connection.
Set user modes and run `erc-after-connect' hook."
(unless erc-server-connected ; only once per session
(let ((server (or erc-server-announced-name (erc-response.sender parsed)))
(nick (car (erc-response.command-args parsed ))))
(setq erc-server-connected t)
(erc-update-mode-line)
(erc-set-initial-user-mode nick)
(erc-server-setup-periodical-server-ping)
(run-hook-with-args 'erc-after-connect server nick))))
(with-current-buffer (process-buffer proc)
(unless erc-server-connected ; only once per session
(let ((server (or erc-server-announced-name
(erc-response.sender parsed)))
(nick (car (erc-response.command-args parsed)))
(buffer (process-buffer proc)))
(setq erc-server-connected t)
(erc-update-mode-line)
(erc-set-initial-user-mode nick buffer)
(erc-server-setup-periodical-ping buffer)
(run-hook-with-args 'erc-after-connect server nick)))))
(defun erc-set-initial-user-mode (nick)
"If `erc-user-mode' is non-nil for NICK, set the user modes."
(when erc-user-mode
(let ((mode (if (functionp erc-user-mode)
(funcall erc-user-mode)
erc-user-mode)))
(when (stringp mode)
(erc-log (format "changing mode for %s to %s" nick mode))
(erc-server-send (format "MODE %s %s" nick mode))))))
(defun erc-set-initial-user-mode (nick buffer)
"If `erc-user-mode' is non-nil for NICK, set the user modes.
The server buffer is given by BUFFER."
(with-current-buffer buffer
(when erc-user-mode
(let ((mode (if (functionp erc-user-mode)
(funcall erc-user-mode)
erc-user-mode)))
(when (stringp mode)
(erc-log (format "changing mode for %s to %s" nick mode))
(erc-server-send (format "MODE %s %s" nick mode)))))))
(defun erc-display-error-notice (parsed string)
"Display STRING as an error notice.
@ -4345,14 +4366,12 @@ If non-nil, return from being away."
erc-nick)))
(cond
(away-p
(erc-with-all-buffers-of-server proc nil
(setq erc-away (current-time))))
(setq erc-away (current-time)))
(t
(let ((away-time erc-away))
;; away must be set to NIL BEFORE sending anything to prevent
;; an infinite recursion
(erc-with-all-buffers-of-server proc nil
(setq erc-away nil))
(setq erc-away nil)
(save-excursion
(set-buffer (erc-active-buffer))
(when erc-public-away-p
@ -5037,8 +5056,9 @@ strings over to the next call."
(defun erc-set-current-nick (nick)
"Set the current nickname to NICK."
(with-current-buffer (or (erc-server-buffer)
(current-buffer))
(with-current-buffer (if (buffer-live-p (erc-server-buffer))
(erc-server-buffer)
(current-buffer))
(setq erc-server-current-nick nick)))
(defun erc-current-nick ()
@ -5119,7 +5139,7 @@ Takes a full SPEC of a user in the form \"nick!login@host\", and
matches against all the regexp's in `erc-ignore-list'. If any
match, returns that regexp."
(catch 'found
(dolist (ignored (with-current-buffer (erc-server-buffer) erc-ignore-list))
(dolist (ignored (erc-with-server-buffer erc-ignore-list))
(if (string-match ignored spec)
(throw 'found ignored)))))
@ -5673,12 +5693,12 @@ entry of `channel-members'."
""))
user))))
(defun erc-away-p ()
"Return t if the current ERC process is set away."
(save-excursion
(and (erc-server-buffer-live-p)
(set-buffer (process-buffer erc-server-process))
erc-away)))
(defun erc-away-time ()
"Return non-nil if the current ERC process is set away.
In particular, the time that we were set away is returned.
See `current-time' for details on the time format."
(erc-with-server-buffer erc-away))
;; Mode line handling
@ -5706,9 +5726,17 @@ The following characters are replaced:
"A string to be formatted and shown in the header-line in `erc-mode'.
Only used starting in Emacs 21.
Set this to nil if you do not want the header line to be
displayed.
See `erc-mode-line-format' for which characters are can be used."
:group 'erc-mode-line-and-header
:type 'string)
:set (lambda (sym val)
(set sym val)
(when (fboundp 'erc-update-mode-line)
(erc-update-mode-line nil)))
:type '(choice (const :tag "Disabled" nil)
string))
(defcustom erc-header-line-uses-help-echo-p t
"Show the contents of the header line in the echo area or as a tooltip
@ -5734,7 +5762,8 @@ Otherwise, use the `erc-header-line' face."
(defcustom erc-common-server-suffixes
'(("openprojects.net$" . "OPN")
("freenode.net$" . "OPN"))
("freenode.net$" . "freenode")
("oftc.net$" . "OFTC"))
"Alist of common server name suffixes.
This variable is used in mode-line display to save screen
real estate. Set it to nil if you want to avoid changing
@ -5786,9 +5815,7 @@ This should be a string with substitution variables recognized by
(defun erc-format-away-status ()
"Return a formatted `erc-mode-line-away-status-format'
if `erc-away' is non-nil."
(let ((a (when (erc-server-buffer-live-p)
(with-current-buffer (process-buffer erc-server-process)
erc-away))))
(let ((a (erc-away-time)))
(if a
(format-time-string erc-mode-line-away-status-format a)
"")))
@ -5813,9 +5840,7 @@ if `erc-away' is non-nil."
(defun erc-format-lag-time ()
"Return the estimated lag time to server, `erc-server-lag'."
(let ((lag (when (erc-server-buffer-live-p)
(with-current-buffer (process-buffer erc-server-process)
erc-server-lag))))
(let ((lag (erc-with-server-buffer erc-server-lag)))
(cond (lag (format "lag:%.0f" lag))
(t ""))))
@ -6137,7 +6162,8 @@ functions."
(format "%s (%s@%s) has left channel %s%s"
nick user host channel
(if (not (string= reason ""))
(format ": %s" reason)
(format ": %s"
(erc-replace-regexp-in-string "%" "%%" reason))
"")))))
@ -6232,6 +6258,13 @@ This function should be on `erc-kill-channel-hook'."
"Find the next occurrence of the `erc-parsed' text property."
(text-property-not-all (point-min) (point-max) 'erc-parsed nil))
(defun erc-restore-text-properties ()
"Restore the property 'erc-parsed for the region."
(let ((parsed-posn (erc-find-parsed-property)))
(put-text-property
(point-min) (point-max)
'erc-parsed (when parsed-posn (erc-get-parsed-vector parsed-posn)))))
(defun erc-get-parsed-vector (point)
"Return the whole parsed vector on POINT."
(get-text-property point 'erc-parsed))
@ -6263,8 +6296,7 @@ Otherwise, connect to HOST:PORT as USER and /join CHANNEL."
(lambda ()
(and (string-equal erc-session-server host)
(= erc-session-port port)
erc-server-connected
(eq (erc-server-buffer) (current-buffer))))))))
(erc-open-server-buffer-p)))))))
(with-current-buffer (or server-buffer (current-buffer))
(if (and server-buffer channel)
(erc-cmd-JOIN channel)

View file

@ -1,3 +1,7 @@
2007-04-01 Michael Olson <mwolson@gnu.org>
* erc.texi: Update for the ERC 5.2 release.
2007-03-31 David Kastrup <dak@gnu.org>
* woman.texi (Topic, Interface Options): Explain changes semantics of

View file

@ -12,7 +12,7 @@
@syncodeindex fn cp
@copying
This manual is for ERC version 5.2 stable pre-release.
This manual is for ERC version 5.2.
Copyright @copyright{} 2005, 2006, 2007 Free Software Foundation, Inc.
@ -21,6 +21,9 @@ Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with no
Invariant Sections, Front-Cover texts, or Back-Cover Texts.
All Emacs Lisp code contained in this document may be used, distributed,
and modified without restriction.
@end quotation
@end copying
@ -68,12 +71,16 @@ Obtaining ERC
* Releases:: Released versions of ERC.
* Development:: Latest unreleased development changes.
Getting Started
* Sample Session:: Example of connecting to the #emacs channel
* Special Features:: Differences from standalone IRC clients
Advanced Usage
* Connecting:: Ways of connecting to an IRC server.
* Options:: Options that are available for ERC.
* Tips and Tricks:: Ways of enhancing your ERC experience.
* Sample Configuration:: An example configuration file.
* Options:: Options that are available for ERC.
@end detailmenu
@end menu
@ -111,8 +118,17 @@ It comes with the following capabilities enabled by default.
* Development:: Latest unreleased development changes.
@end menu
These sections may be skipped if you are using the version of ERC that
comes with Emacs.
Note that some ERC files are not included with Emacs due to copyright or
dependency issues. If desired, they may be found at the following
locations, or from your local GNU mirror.
@itemize @bullet
@item @uref{http://ftp.gnu.org/gnu/erc/erc-5.2-extras.tar.gz}
@item @uref{http://ftp.gnu.org/gnu/erc/erc-5.2-extras.zip}
@end itemize
The rest of this chapter may be skipped if you are using the version of
ERC that comes with Emacs.
@node Releases, Development, Obtaining ERC, Obtaining ERC
@comment node-name, next, previous, up
@ -131,7 +147,7 @@ available in the official Debian repository.
@cindex releases, from source
Alternatively, you can download the latest release from
@uref{http://ftp.gnu.org/gnu/erc}.
@uref{http://ftp.gnu.org/gnu/erc}, or your local GNU mirror.
@node Development, , Releases, Obtaining ERC
@comment node-name, next, previous, up
@ -188,9 +204,9 @@ tla update
@end enumerate
If you are new to Arch and want to learn more about developing with it,
you might find this tutorial helpful:
@uref{http://www.mwolson.org/projects/ArchTutorial.html}.
If you are new to Arch and want to learn more about developing ERC with
it, visit @uref{http://emacswiki.org/cgi-bin/wiki/ErcDevelopment} for
full instructions.
@subheading Development snapshots
@ -261,8 +277,6 @@ locations that require this.
@chapter Getting Started
@cindex settings
@c PRE5_2: Mention .ercrc.el
To use ERC, add the directory containing its files to your
@code{load-path} variable, in your @file{.emacs} file. Then, load ERC
itself. An example follows.
@ -274,20 +288,151 @@ itself. An example follows.
Once ERC is loaded, the command @kbd{M-x erc} will start ERC and
prompt for the server to connect to.
If you want to place ERC settings in their own file, you can place them
in @file{~/.emacs.d/.ercrc.el}, creating it if necessary.
If you would rather use the Customize interface to change how ERC works,
do @kbd{M-x customize-group RET erc RET}. In particular, ERC comes with
lots of modules that may be enabled or disabled; to select which ones
you want, do @kbd{M-x customize-variable RET erc-modules RET}.
@menu
* Sample Session:: Example of connecting to the #emacs channel
* Special Features:: Differences from standalone IRC clients
@end menu
@node Sample Session, Special Features, Getting Started, Getting Started
@comment node-name, next, previous, up
@section Sample Session
This is an example ERC session which shows how to connect to the #emacs
channel on Freenode. Another IRC channel on Freenode that may be of
interest is #erc, which is a channel where ERC users and developers hang
out.
@itemize @bullet
@item Connect to Freenode
Run @kbd{M-x erc}. Use ``irc.freenode.net'' as the IRC server, ``6667''
as the port, and choose a nickname.
@item Get used to the interface
Switch to the ``irc.freenode.net:6667'' buffer, if you're not already
there. You will see first some messages about checking for ident, and
then a bunch of other messages that describe the current IRC server.
@item Join the #emacs channel
In that buffer, type ``/join SPC #emacs'' and hit @kbd{RET}. Depending
on how you've set up ERC, either a new buffer for ``#emacs'' will be
displayed, or a new buffer called ``#emacs'' will be created in the
background. If the latter, switch to the ``#emacs'' buffer. You will
see the channel topic and a list of the people who are currently on the
channel.
@item Register your nickname with Freenode
If you would like to be able to talk with people privately on the
Freenode network, you will have to ``register'' your nickname. To do
so, switch to the ``irc.freenode.net:6667'' buffer and type ``/msg
NickServ register <password>'', replacing ``<password>'' with your
desired password. It should tell you that the operation was successful.
@item Talk to people in the channel
If you switch back to the ``#emacs'' buffer, you can type a message, and
everyone on the channel will see it.
@item Open a query buffer to talk to someone
If you want to talk with someone in private (this should usually not be
done for technical help, only for personal questions), type ``/query
<nick>'', replacing ``<nick>'' with the nickname of the person you would
like to talk to. Depending on how ERC is set up, you will either see a
new buffer with the name of the person, or such a buffer will be created
in the background and you will have to switch to it. Begin typing
messages, and you will be able to have a conversation.
Note that if the other person is not registered, you will not be able to
talk with them.
@end itemize
@node Special Features, , Sample Session, Getting Started
@comment node-name, next, previous, up
@section Special Features
ERC has some features that distinguish it from some IRC clients.
@itemize @bullet
@item multiple channels and multiple servers
Every channel is put in a separate buffer. Several IRC servers may be
connected to at the same time.
@cindex query buffers
@item private message separation
Private conversations are treated as channels, and are put into separate
buffers in Emacs. We call these ``query buffers''.
@item highlighting
Some occurences of words can be highlighted, which makes it easier to
track different kinds of conversations.
@item notification
ERC can notify you that certain users are online.
@item channel tracking
Channels can be hidden and conversation continue in the background. You
are notified when something is said in such a channel that is not
currently visible. This makes it easy to get Real Work done while still
maintaining an IRC presence.
@item nick completion
ERC can complete words upon hitting @kbd{TAB}, which eases the writing
of nicknames in messages.
@cindex history ring
@item history
Past actions are kept in history rings for future use. To navigate a
history ring, hit @kbd{M-p} to go backwards and @kbd{M-n} to go
forwards.
@item multiple languages
Different channels and servers may have different language encodings.
In addition, it is possible to translate the messages that ERC uses into
multiple languages. Please contact the developers of ERC at
@email{erc-discuss@@gnu.org} if you are interested in helping with the
translation effort.
@item user scripting
Users can load scripts (e.g. auto greeting scripts) when ERC starts up.
It is also possible to make custom IRC commands, if you know a little
Emacs Lisp. Just make an Emacs Lisp function and call it
@code{erc-cmd-NEWCOMMAND}, where @code{NEWCOMMAND} is the name of the
new command in capital letters.
@item auto reconnect
If the connection goes away at some point, ERC will try to reconnect
automatically. If it fails to reconnect, and you want to try to
manually reestablish the connection at some later point, switch to an
ERC buffer and run the /RECONNECT command.
ERC buffer and run the @code{/RECONNECT} command.
@c PRE5_2: Sample session, including:
@c - connect to Freenode
@c - /join #emacs
@c - see messages flying past, point out topic lines, messages, channel
@c members
@c - identifying your nick with NickServ (most IRC servers have this)
@c - talking to the channel
@c - open a /query buffer to talk to someone (must identify first in
@c FreeNode)
@end itemize
@node Keystroke Summary, Modules, Getting Started, Top
@ -439,6 +584,10 @@ Save buffers in logs
@item match
Highlight pals, fools, and other keywords
@cindex modules, menu
@item menu
Display a menu in ERC buffers
@cindex modules, netsplit
@item netsplit
Detect netsplits
@ -505,7 +654,7 @@ Translate morse code in messages
@end table
@c PRE5_2: Document every option of every module in its own subnode
@c PRE5_3: Document every option of every module in its own subnode
@node Advanced Usage, Getting Help and Reporting Bugs, Modules, Top
@ -515,12 +664,11 @@ Translate morse code in messages
@menu
* Connecting:: Ways of connecting to an IRC server.
* Options:: Options that are available for ERC.
* Tips and Tricks:: Ways of enhancing your ERC experience.
* Sample Configuration:: An example configuration file.
* Options:: Options that are available for ERC.
@end menu
@node Connecting, Options, Advanced Usage, Advanced Usage
@node Connecting, Sample Configuration, Advanced Usage, Advanced Usage
@comment node-name, next, previous, up
@section Connecting to an IRC Server
@cindex connecting
@ -654,33 +802,97 @@ User full name.
This can be either a string or a function to call.
@end defopt
@node Options, Tips and Tricks, Connecting, Advanced Usage
@comment node-name, next, previous, up
@section Options
@cindex options
@c PRE5_2: (Node) Document every ERC option (module options go in
@c previous chapter)
This section has not yet been written.
@node Tips and Tricks, Sample Configuration, Options, Advanced Usage
@comment node-name, next, previous, up
@section Tips and Tricks
@cindex tips and tricks
@c PRE5_2: (Node) Tips and tricks
This section has not yet been written.
@node Sample Configuration, , Tips and Tricks, Advanced Usage
@node Sample Configuration, Options, Connecting, Advanced Usage
@comment node-name, next, previous, up
@section Sample Configuration
@cindex configuration, sample
@c PRE5_2: (Node) Sample configs
Here is an example of configuration settings for ERC. This can go into
your Emacs configuration file. Everything after the @code{(require
'erc)} command can optionally go into @file{~/.emacs.d/.ercrc.el}.
This section has not yet been written.
@lisp
;;; Sample ERC configuration
;; Add the ERC directory to load path -- you don't need this if you are
;; using the version of ERC that comes with Emacs
(add-to-list 'load-path "~/elisp/erc")
;; Load ERC
(require 'erc)
;; Load authentication info from an external source. Put sensitive
;; passwords and the like in here.
(load "~/.emacs.d/.erc-auth")
;; This is an example of how to make a new command. Type "/uptime" to
;; use it.
(defun erc-cmd-UPTIME (&rest ignore)
"Display the uptime of the system, as well as some load-related
stuff, to the current ERC buffer."
(let ((uname-output
(replace-regexp-in-string
", load average: " "] @{Load average@} ["
;; Collapse spaces, remove
(replace-regexp-in-string
" +" " "
;; Remove beginning and trailing whitespace
(replace-regexp-in-string
"^ +\\|[ \n]+$" ""
(shell-command-to-string "uptime"))))))
(erc-send-message
(concat "@{Uptime@} [" uname-output "]"))))
;; This causes ERC to connect to the Freenode network upon hitting
;; C-c e f. Replace MYNICK with your IRC nick.
(global-set-key "\C-cef" (lambda () (interactive)
(erc :server "irc.freenode.net" :port "6667"
:nick "MYNICK")))
;; This causes ERC to connect to the IRC server on your own machine (if
;; you have one) upon hitting C-c e b. Replace MYNICK with your IRC
;; nick. Often, people like to run bitlbee (http://bitlbee.org/) as an
;; AIM/Jabber/MSN to IRC gateway, so that they can use ERC to chat with
;; people on those networks.
(global-set-key "\C-ceb" (lambda () (interactive)
(erc :server "localhost" :port "6667"
:nick "MYNICK")))
;; Make C-c RET (or C-c C-RET) send messages instead of RET. This has
;; been commented out to avoid confusing new users.
;; (define-key erc-mode-map (kbd "RET") nil)
;; (define-key erc-mode-map (kbd "C-c RET") 'erc-send-current-line)
;; (define-key erc-mode-map (kbd "C-c C-RET") 'erc-send-current-line)
;;; Options
;; Join the #emacs and #erc channels whenever connecting to Freenode.
(setq erc-autojoin-channels-alist '(("freenode.net" "#emacs" "#erc")))
;; Interpret mIRC-style color commands in IRC chats
(setq erc-interpret-mirc-color t)
;; The following are commented out by default, but users of other
;; non-Emacs IRC clients might find them useful.
;; Kill buffers for channels after /part
;; (setq erc-kill-buffer-on-part t)
;; Kill buffers for private queries after quitting the server
;; (setq erc-kill-queries-on-quit t)
;; Kill buffers for server messages after quitting the server
;; (setq erc-kill-server-buffer-on-quit t)
@end lisp
@node Options, , Sample Configuration, Advanced Usage
@comment node-name, next, previous, up
@section Options
@cindex options
@c PRE5_3: (Node) Document every ERC option (module options go in
@c previous chapter)
This section has not yet been written. For now, the easiest way to
check out the available option for ERC is to do
@kbd{M-x customize-group erc RET}.
@node Getting Help and Reporting Bugs, History, Advanced Usage, Top