1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-24 07:20:37 +00:00

Merge from erc--emacs--22

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

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

Revision: emacs@sv.gnu.org/emacs--devo--0--patch-520
Creator:  Michael Olson <mwolson@gnu.org>
This commit is contained in:
Miles Bader 2006-11-20 06:50:29 +00:00
parent e15a04955b
commit 83dc699514
20 changed files with 439 additions and 180 deletions

View File

@ -1,3 +1,7 @@
2006-11-20 Michael Olson <mwolson@gnu.org>
* NEWS: Change M-x erc-select to M-x erc.
2006-11-20 Sun Yijiang <sunyijiang@gmail.com>
* TUTORIAL.cn: Updated.
@ -92,6 +96,11 @@
* PROBLEMS (are): Emacs compiled with Gtk+ crashes when closing a
display (x-close-connection).
2006-09-03 Diane Murray <disumu@x3y2z1.net>
* erc.texi (Getting Started, Connecting): Changed erc-select to
erc.
2006-09-02 Juri Linkov <juri@jurta.org>
* HELLO: Regroup Europe Non-ASCII examples by similar scripts.

View File

@ -1,5 +1,21 @@
ERC NEWS -*- outline -*-
* Changes in ERC 5.2 (stable pre-release for Emacs 22)
** M-x erc RET now starts ERC.
`erc-select' has been changed to `erc'. `erc-select' still remains as
an alias of `erc'. Likewise, `erc-select-ssl' has been renamed to
`erc-ssl' with `erc-select-ssl' as its alias. The function that was
known as `erc' is now `erc-open'.
** Changes and additions to modules
*** Channel tracking (erc-track.el)
**** Use mouse-face and help-echo for channel names in the mode-line.
This helps people using a mouse know that they are buttons and can be
clicked on.
* Changes in ERC 5.1.4
** Make find-function and find-variable work in Emacs 22 for

View File

@ -1690,8 +1690,8 @@ ERC is a powerful, modular, and extensible IRC client for Emacs.
To see what modules are available, type
M-x customize-option erc-modules RET.
To start an IRC session, type M-x erc-select, and follow the prompts
for server, port, and nick.
To start an IRC session, type M-x erc, and follow the prompts for
server, port, and nick.
---
** Rcirc is now part of the Emacs distribution.

View File

@ -1,3 +1,28 @@
2006-11-20 Michael Olson <mwolson@gnu.org>
* erc.el (erc-version-string): Call this Version 5.2 stable
pre-release, since it diverges slightly from our 5.2 branch, in
that unstable features are not included.
(erc-update-modules): Display better error message when module not
found.
2006-11-12 Michael Olson <mwolson@gnu.org>
* erc-log.el: Save all log buffers when Emacs exits, in case
someone ignores the warning about open processes. Remove the
advice code in the commentary.
(erc-save-query-buffers): Docfix.
(erc-log-save-all-buffers): New function that saves all ERC
buffers to logs.
(erc-current-logfile): Fix bug in filename selection, where the
current buffer was erroneously being preferred over the given
buffer.
2006-11-08 Michael Olson <mwolson@gnu.org>
* erc.el (erc-string-to-port): Avoid error when a numerical port
is passed. Thanks to Zekeriya KOÇ for the report.
2006-11-08 Łukasz Demianiuk <ldemianiuk@gmail.com> (tiny change)
* erc.el (erc-header-line): Fix typo.
@ -10,11 +35,168 @@
* erc-autoaway.el (erc-autoaway-reestablish-idletimer):
* erc-truncate.el (truncate): Fix typo in docstring.
2006-10-21 Michael Olson <mwolson@gnu.org>
* erc.el (erc-iswitchb): Fix bug when hitting C-c C-b without
first loading iswitchb. Thanks to Leo for the report.
2006-10-10 Michael Olson <mwolson@gnu.org>
* erc.el (erc-default-port): Make the default be 6667 instead of
ircd. since Mac OS X apparently has problems with looking up that
port name.
* erc-backend.el (353): Receive names after displaying the initial
message, instead of before.
2006-10-05 Diane Murray <disumu@x3y2z1.net>
* erc.el (erc-my-nick-face): New face.
(erc): Use FULL-NAME argument, not `erc-user-full-name'. This
fixes a bug where the :full-name argument passed to the function
was not respected.
(erc-format-my-nick): Use `erc-my-nick-face'. This should help
make it easier to find messages you sent in conversations when
`erc-show-my-nick' is non-nil.
(erc-compute-server): Doc fix.
2006-09-11 Michael Olson <mwolson@gnu.org>
* erc-nicklist.el (erc-nicklist-insert-contents): Add missing
parenthesis. Thanks to Stephan Stahl for the report.
2006-09-10 Eric Hanchrow <offby1@blarg.net>
* erc.el (erc-cmd-IGNORE): Prompt user if this might be a regexp
instead of a single user.
2006-09-10 Michael Olson <mwolson@gnu.org>
* erc.el (erc-generate-new-buffer-name): If this is a server
buffer and a process exists already, create a new buffer.
(erc-open): If the IRC session was continued, restore the old
point. Thanks to Stephan Stahl for the report.
(erc-member-ignore-case): Coding style tweak.
(erc-cmd-UNIGNORE): Quote the user before comparison. If we don't
find the user listed verbatim, try to match them against the list
using string-match. In this case, prompt as to whether the regexp
should be removed.
(erc-ignored-user-p): Remove CL-ism.
* erc-autoaway.el (erc-autoaway-possibly-set-away): Check to see
whether we are already away.
* erc-menu.el: Fix potential compiler warning.
2006-09-07 Diane Murray <disumu@x3y2z1.net>
* erc.el: Updated Commentary and URL.
(erc-iswitchb, erc-display-line, erc-set-modes, erc-update-modes)
(erc-arrange-session-in-multiple-windows): No need to check if
`erc-server-process' is bound.
(erc-server-buffer-live-p): Doc fix.
(erc-part-from-channel): Don't use any initial contents at prompt.
(erc-format-nick, erc-format-@nick): Doc fix. Use `when'.
(s367): Fixed to support only banmask and channel which is the
standard. Also, there's no reason to add a message to each banned
user entry trying to persuade the user to use /banlist instead of
/mode #channel +b. That part of the message was a little
confusing, anyways.
(s367-set-by): New catalog entry. The user who set the ban and
the time of ban seem to be specific to only certain servers such
as freenode.
* erc-autoaway.el (erc-autoaway-idletimer): Doc fix.
* erc-backend.el (erc-server-process-alive): No need to check if
`erc-server-process' is bound.
(367): Use s367 or s367-set-by where appropriate.
* erc-compat.el: Fixed URL.
* erc-dcc.el: Updated copyright years. Added Usage section.
Changed supported Emacs version number from 21.3.50 to 22 in
Commentary.
* erc-ibuffer.el (erc-server-name, erc-target, erc-away): No need
to check if `erc-server-process' is bound.
* erc-nicklist.el: Added to the Commentary section an explanation
that `erc-nicklist-quit' should be called from within the nicklist
buffer. Set file coding to utf-8 so a contributor's name is
displayed correctly.
(erc-nicklist-icons-directory): Use customize type directory
instead of string.
(erc-nicklist-insert-contents): Set bbdb-nick to an empty string
if it wasn't found. This fixes a bug where an error would occur
when using `string=' on bbdb-nick if it was nil.
* erc-replace.el: Removed URL from file information since it
doesn't exist.
* erc-sound.el: Updated copyright years. Fixed Commentary and
added Usage section.
(define-erc-module): Add and remove `erc-ctcp-query-SOUND' to
`erc-ctcp-query-SOUND-hook' here. Removed the keybinding
definitions.
(erc-play-sound, erc-default-sound, erc-cmd-SOUND)
(erc-ctcp-query-SOUND): Doc fix.
(erc-play-command): Removed, not necessary anymore.
(erc-ctcp-query-SOUND-hook): Set to nil as default. Moved up
higher in code, added docstring.
(erc-play-sound): Use `play-sound-file'. It exists in GNU Emacs
as well since version 21 or earlier. Removed commented-out older
version of function.
* NEWS: Fixed formatting, added channel tracking change.
2006-09-03 Diane Murray <disumu@x3y2z1.net>
* erc.el: M-x erc RET can now be used to start ERC.
(erc-open): Renamed from `erc'.
(erc-before-connect): Change erc-select to erc.
(erc): Renamed from `erc-select'. Use `erc-open'.
(erc-select): Defined as alias of `erc'.
(erc-ssl): Renamed from `erc-select-ssl'. Use `erc'.
(erc-select-ssl): Defined as alias of `erc-ssl'.
(erc-cmd-SERVER): Use `erc'.
(erc-query, erc-handle-irc-url): Use `erc-open'.
* erc-backend.el (erc-process-sentinel-1, JOIN): Use `erc-open'.
* erc-menu.el (erc-menu-definition): Use `erc'.
* erc-networks.el: Updated copyright years.
(erc-server-select): Use keyword arguments when calling `erc'.
* erc.texi (Getting Started, Connecting): Changed erc-select to
erc.
* NEWS: Added note about these changes.
2006-08-21 Diane Murray <disumu@x3y2z1.net>
* erc-track.el (erc-track-mode-line-mouse-face): New variable.
(erc-make-mode-line-buffer-name): Add help-echo and mouse-face
properties to channel name.
2006-08-14 Diane Murray <disumu@x3y2z1.net>
* erc-menu.el: Updated copyright years. Removed EmacsWiki URL.
(erc-menu-definition): Name the menu "ERC" instead of "IRC" to
avoid confusion with rcirc and other clients.
2006-08-13 Romain Francoise <romain@orebokech.com>
* erc-match.el (erc-log-matches-make-buffer): End `y-or-n-p'
prompt with a space.
2006-08-11 Michael Olson <mwolson@gnu.org>
* erc-fill.el (erc-fill): Skip any initial empty lines so that we
avoid errors when inserting disconnect messages and other messages
that begin with newlines.
2006-08-07 Michael Olson <mwolson@gnu.org>
* erc-backend.el (erc-process-sentinel-1): Use erc-display-message
@ -32,6 +214,9 @@
2006-08-06 Michael Olson <mwolson@gnu.org>
* erc-backend.el (erc-server-send-queue): Update from Circe
version of this function.
* erc.el (erc-arrange-session-in-multiple-windows): Fix bug with
multi-tty Emacs.
(erc-select-startup-file): Fix bug introduced by recent change.

View File

@ -38,7 +38,7 @@ yourself back when you type something."
(defvar erc-autoaway-idletimer nil
"The Emacs idletimer.
This is only used when `erc-autoaway-use-emacs-idle' is non-nil.")
This is only used when `erc-autoaway-idle-method' is set to 'emacs.")
;;;###autoload (autoload 'erc-autoaway-mode "erc-autoaway")
(define-erc-module autoaway nil
@ -206,6 +206,7 @@ exceeds `erc-autoaway-idle-seconds'."
;; this function is called from `erc-timer-hook', which is called
;; whenever the server sends something to the client.
(when (and erc-auto-set-away
(not erc-autoaway-caused-away)
(not (erc-away-p)))
(let ((idle-time (erc-time-diff erc-autoaway-last-sent-time
current-time)))

View File

@ -416,7 +416,7 @@ Currently this is called by `erc-send-input'."
(defun erc-server-process-alive ()
"Return non-nil when `erc-server-process' is open or running."
(and (boundp 'erc-server-process)
(and erc-server-process
(processp erc-server-process)
(memq (process-status erc-server-process) '(run open))))
@ -512,8 +512,8 @@ action."
(not (string-match "^failed with code 111" event)))
;; Yuck, this should perhaps funcall
;; erc-server-reconnect-function with no args
(erc erc-session-server erc-session-port erc-server-current-nick
erc-session-user-full-name t erc-session-password)
(erc-open erc-session-server erc-session-port erc-server-current-nick
erc-session-user-full-name t erc-session-password)
;; terminate, do not reconnect
(erc-display-message nil 'error (current-buffer)
'terminated ?e event))))
@ -673,7 +673,8 @@ protection algorithm."
(error nil)))))
(when erc-server-flood-queue
(setq erc-server-flood-timer
(run-at-time 2 nil #'erc-server-send-queue buffer))))))
(run-at-time (+ 0.2 erc-server-flood-penalty)
nil #'erc-server-send-queue buffer))))))
(defun erc-message (message-command line &optional force)
"Send LINE to the server as a privmsg or a notice.
@ -1038,11 +1039,11 @@ add things to `%s' instead."
(let* ((str (cond
;; If I have joined a channel
((erc-current-nick-p nick)
(setq buffer (erc erc-session-server erc-session-port
nick erc-session-user-full-name
nil nil
erc-default-recipients chnl
erc-server-process))
(setq buffer (erc-open erc-session-server erc-session-port
nick erc-session-user-full-name
nil nil
erc-default-recipients chnl
erc-server-process))
(when buffer
(set-buffer buffer)
(erc-add-default-channel chnl)
@ -1583,11 +1584,11 @@ See `erc-display-server-message'." nil
"NAMES notice." nil
(let ((channel (third (erc-response.command-args parsed)))
(users (erc-response.contents parsed)))
(erc-with-buffer (channel proc)
(erc-channel-receive-names users))
(erc-display-message parsed 'notice (or (erc-get-buffer channel proc)
'active)
's353 ?c channel ?u users)))
's353 ?c channel ?u users)
(erc-with-buffer (channel proc)
(erc-channel-receive-names users))))
(define-erc-response-handler (366)
"End of NAMES." nil
@ -1598,11 +1599,16 @@ See `erc-display-server-message'." nil
"Channel ban list entries" nil
(multiple-value-bind (channel banmask setter time)
(cdr (erc-response.command-args parsed))
(erc-display-message parsed 'notice 'active 's367
?c channel
?b banmask
?s setter
?t time)))
;; setter and time are not standard
(if setter
(erc-display-message parsed 'notice 'active 's367-set-by
?c channel
?b banmask
?s setter
?t (or time ""))
(erc-display-message parsed 'notice 'active 's367
?c channel
?b banmask))))
(define-erc-response-handler (368)
"End of channel ban list" nil

View File

@ -3,7 +3,7 @@
;; Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
;; Author: Alex Schroeder <alex@gnu.org>
;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?EmacsIRCClient
;; URL: http://www.emacswiki.org/cgi-bin/wiki/ERC
;; This file is part of GNU Emacs.

View File

@ -35,7 +35,9 @@
;; rewritten to support the way how ERC operates. Server socket support
;; was added for DCC CHAT and SEND afterwards. Thanks
;; to the original authors for their work.
;;
;;; Usage:
;; To use this file, put
;; (require 'erc-dcc)
;; in your .emacs.
@ -49,7 +51,7 @@
;; /dcc send nick file - Offer DCC SEND to nick
;;
;; Please note that offering DCC connections (offering chats and sending
;; files) is only supported with Emacs 21.3.50 (CVS).
;; files) is only supported with Emacs 22.
;;; Code:

View File

@ -122,7 +122,15 @@ characters. Set to nil to disable."
You can put this on `erc-insert-modify-hook' and/or `erc-send-modify-hook'."
(unless (erc-string-invisible-p (buffer-substring (point-min) (point-max)))
(when erc-fill-function
(funcall erc-fill-function))))
;; skip initial empty lines
(goto-char (point-min))
(save-match-data
(while (and (looking-at "[ \t\n]*$")
(= (forward-line 1) 0))))
(unless (eobp)
(save-restriction
(narrow-to-region (point) (point-max))
(funcall erc-fill-function))))))
(defun erc-fill-static ()
"Fills a text such that messages start at column `erc-fill-static-center'."

View File

@ -91,14 +91,14 @@
" "))
(define-ibuffer-column erc-server-name (:name "Server")
(if (and (boundp 'erc-server-process) (processp erc-server-process))
(if (and erc-server-process (processp erc-server-process))
(with-current-buffer (process-buffer erc-server-process)
(or erc-server-announced-name erc-session-server))
""))
(define-ibuffer-column erc-target (:name "Target")
(if (eq major-mode 'erc-mode)
(cond ((and (boundp 'erc-server-process) (processp erc-server-process)
(cond ((and erc-server-process (processp erc-server-process)
(eq (current-buffer) (process-buffer erc-server-process)))
(concat "Server " erc-session-server ":"
(erc-port-to-string erc-session-port)))
@ -125,7 +125,7 @@
""))
(define-ibuffer-column erc-away (:name "A")
(if (and (boundp 'erc-server-process)
(if (and erc-server-process
(processp erc-server-process)
(with-current-buffer (process-buffer erc-server-process)
erc-away))

View File

@ -43,14 +43,6 @@
;;
;; (require 'erc-log)
;;
;; You may optionally want the following code, to save all ERC buffers
;; without confirmation when exiting emacs:
;;
;; (defadvice save-buffers-kill-emacs (before save-logs (&rest args) activate)
;; (save-some-buffers t (lambda ()
;; (when (and (eq major-mode 'erc-mode)
;; (not (null buffer-file-name))) t))))
;;
;; If you only want to save logs for some buffers, customise the
;; variable `erc-enable-logging'.
@ -213,6 +205,7 @@ also be a predicate function. To only log when you are not set away, use:
(add-hook 'erc-send-post-hook 'erc-save-buffer-in-logs))
(add-hook 'erc-kill-buffer-hook 'erc-save-buffer-in-logs)
(add-hook 'erc-kill-channel-hook 'erc-save-buffer-in-logs)
(add-hook 'kill-emacs-hook 'erc-log-save-all-buffers)
(add-hook 'erc-quit-hook 'erc-conditional-save-queries)
(add-hook 'erc-part-hook 'erc-conditional-save-buffer)
;; append, so that 'erc-initialize-log-marker runs first
@ -225,6 +218,7 @@ also be a predicate function. To only log when you are not set away, use:
(remove-hook 'erc-send-post-hook 'erc-save-buffer-in-logs)
(remove-hook 'erc-kill-buffer-hook 'erc-save-buffer-in-logs)
(remove-hook 'erc-kill-channel-hook 'erc-save-buffer-in-logs)
(remove-hook 'kill-emacs-hook 'erc-log-save-all-buffers)
(remove-hook 'erc-quit-hook 'erc-conditional-save-queries)
(remove-hook 'erc-part-hook 'erc-conditional-save-buffer)
(remove-hook 'erc-connect-pre-hook 'erc-log-setup-logging)
@ -263,7 +257,7 @@ Returns nil iff `erc-server-buffer-p' returns t."
(not (erc-server-buffer-p)))))
(defun erc-save-query-buffers (process)
"Save all buffers process."
"Save all buffers of the given PROCESS."
(erc-with-all-buffers-of-server process
nil
(erc-save-buffer-in-logs)))
@ -278,6 +272,12 @@ Returns nil iff `erc-server-buffer-p' returns t."
(when erc-save-queries-on-quit
(erc-save-query-buffers process)))
;; Make sure that logs get saved, even if someone overrides the active
;; process prompt for a quick exit from Emacs
(defun erc-log-save-all-buffers ()
(dolist (buffer (erc-buffer-list))
(erc-save-buffer-in-logs buffer)))
;;;###autoload
(defun erc-logging-enabled (&optional buffer)
"Return non-nil if logging is enabled for BUFFER.
@ -309,7 +309,7 @@ The result is converted to lowercase, as IRC is case-insensitive"
(erc-log-standardize-name
(funcall erc-generate-log-file-name-function
(or buffer (current-buffer))
(or (erc-default-target) (buffer-name buffer))
(or (buffer-name buffer) (erc-default-target))
(erc-current-nick)
erc-session-server erc-session-port))
erc-log-channels-directory))

View File

@ -4,7 +4,6 @@
;; Author: Mario Lang <mlang@delysid.org>
;; Keywords: comm, processes, menu
;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ErcMenu
;; This file is part of GNU Emacs.
@ -29,11 +28,12 @@
;;; Code:
;(require 'erc)
(require 'easymenu)
(defvar erc-menu-definition
(list "IRC"
["Connect to server..." erc-select t]
(list "ERC"
["Connect to server..." erc t]
["Disconnect from server..." erc-quit-server erc-server-connected]
"-"
["List channels..." erc-list-channels

View File

@ -809,7 +809,7 @@ As an example:
(erc-ports-list (nth 3 srv))
(list (nth 3 srv))))
(port (nth (random (length ports)) ports)))
(erc host port erc-nick erc-user-full-name t)))
(erc :server host :port port)))
;;; The following experimental
;; It does not work yet, help me with it if you

View File

@ -29,7 +29,7 @@
;; This provides a minimal mIRC style nicklist buffer for ERC. To
;; activate, do M-x erc-nicklist RET in the channel buffer you want
;; the nicklist to appear for. To close and quit the nicklist
;; buffer, do M-x erc-nicklist-quit RET.
;; buffer, do M-x erc-nicklist-quit RET from within the nicklist buffer.
;;
;; TODO:
;; o Somehow associate nicklist windows with channel windows so they
@ -97,7 +97,7 @@ By \"chat medium\", we mean IRC, AOL, MSN, ICQ, etc."
"*Directory of the PNG files for chat icons.
Icons are displayed if `erc-nicklist-use-icons' is non-nil."
:group 'erc-nicklist
:type 'string)
:type 'directory)
(defcustom erc-nicklist-voiced-position 'bottom
"*Position of voiced nicks in the nicklist.
@ -207,7 +207,9 @@ Seach for the BBDB record of this contact. If not found, return nil."
(channels (erc-server-user-buffers server-user))
(op (erc-channel-user-op channel-user))
(voice (erc-channel-user-voice channel-user))
(bbdb-nick (erc-nicklist-search-for-nick (concat login "@" host)))
(bbdb-nick (or (erc-nicklist-search-for-nick
(concat login "@" host))
""))
(away-status (if voice "" "\n(Away)"))
(balloon-text (concat bbdb-nick (if (string= "" bbdb-nick)
"" "\n")
@ -406,6 +408,7 @@ list has all the voiced users according to
;; Local Variables:
;; indent-tabs-mode: t
;; tab-width: 8
;; coding: utf-8
;; End:
;; arch-tag: db37a256-87a7-4544-bd90-e5f16c9f5ca5

View File

@ -5,7 +5,6 @@
;; Author: Andreas Fuchs <asf@void.at>
;; Maintainer: Mario Lang (mlang@delysid.org)
;; Keywords: IRC, client, Internet
;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ErcReplace
;; This file is part of GNU Emacs.

View File

@ -21,9 +21,26 @@
;;; Commentary:
;; This used to be in erc.el, I (Jorgen) just extracted it from there
;; and put it in this file. Bugs and features are those of the
;; original author.
;; Play sounds when users send you CTCP SOUND messages.
;; This file also defines the command /sound so that you can send
;; sound requests to other users.
;;; Usage:
;; Add the following to your .emacs if you want to play sounds.
;;
;; (require 'erc-soud)
;; (erc-sound-enable)
;;
;; To send requests to other users from within query buffers, type the
;; following:
;;
;; /sound filename optional-message-text
;;
;; You can also type the following:
;;
;; /ctcp nickname sound filename optional-message
;;; Code:
@ -34,9 +51,11 @@
"In ERC sound mode, the client will respond to CTCP SOUND requests
and play sound files as requested."
;; Enable:
((define-key erc-mode-map "\C-c\C-s" 'erc-toggle-sound))
((add-hook 'erc-ctcp-query-SOUND-hook 'erc-ctcp-query-SOUND)
(define-key erc-mode-map "\C-c\C-s" 'erc-toggle-sound))
;; Disable:
((define-key erc-mode-map "\C-c\C-s" 'undefined)))
((remove-hook 'erc-ctcp-query-SOUND-hook 'erc-ctcp-query-SOUND)
(define-key erc-mode-map "\C-c\C-s" 'undefined)))
(erc-define-catalog-entry 'english 'CTCP-SOUND "%n (%u@%h) plays %s:%m")
@ -45,7 +64,7 @@ and play sound files as requested."
:group 'erc)
(defcustom erc-play-sound t
"*Play sound on SOUND ctcp requests (used in ICQ chat)."
"*Play sounds when you receive CTCP SOUND requests."
:group 'erc-sound
:type 'boolean)
@ -55,18 +74,22 @@ and play sound files as requested."
:type '(repeat directory))
(defcustom erc-default-sound nil
"Play this sound if the requested file was not found."
"Play this sound if the requested file was not found.
If this is set to nil or the file doesn't exist a beep will sound."
:group 'erc-sound
:type '(choice (const nil)
file))
(defcustom erc-play-command "play"
"Command for playing sound samples."
:group 'erc-sound
:type 'string)
(defvar erc-ctcp-query-SOUND-hook nil
"Hook to run after receiving a CTCP SOUND request.")
(defun erc-cmd-SOUND (line &optional force)
"Play the sound given in LINE."
"Send a CTCP SOUND message to the default target.
If `erc-play-sound' is non-nil, play the sound as well.
/sound filename optional-message-text
LINE is the text entered, including the command."
(cond
((string-match "^\\s-*\\(\\S-+\\)\\(\\s-.*\\)?$" line)
(let ((file (match-string 1 line))
@ -84,8 +107,8 @@ and play sound files as requested."
t))
(t nil)))
(defvar erc-ctcp-query-SOUND-hook '(erc-ctcp-query-SOUND))
(defun erc-ctcp-query-SOUND (proc nick login host to msg)
"Display a CTCP SOUND message and play sound if `erc-play-sound' is non-nil."
(when (string-match "^SOUND\\s-+\\(\\S-+\\)\\(\\(\\s-+.*\\)\\|\\(\\s-*\\)\\)$" msg)
(let ((sound (match-string 1 msg))
(comment (match-string 2 msg)))
@ -96,42 +119,16 @@ and play sound files as requested."
nil)
(defun erc-play-sound (file)
"Plays a sound file located in one of the directories in `erc-sound-path'
with a command `erc-play-command'."
"Play a sound file located in one of the directories in `erc-sound-path'.
See also `play-sound-file'."
(let ((filepath (erc-find-file file erc-sound-path)))
(if (and (not filepath) erc-default-sound)
(setq filepath erc-default-sound))
(cond ((and filepath (file-exists-p filepath))
(if (and (fboundp 'device-sound-enabled-p)
(device-sound-enabled-p))
; For XEmacs
(play-sound-file filepath)
; (start-process "erc-sound" nil erc-play-command filepath)
(start-process "erc-sound" nil "/bin/tcsh" "-c"
(concat erc-play-command " " filepath))))
(play-sound-file filepath))
(t (beep)))
(erc-log (format "Playing sound file %S" filepath))))
;(defun erc-play-sound (file)
; "Plays a sound file located in one of the directories in `erc-sound-path'
; with a command `erc-play-command'."
; (let ((filepath nil)
; (paths erc-sound-path))
; (while (and paths
; (progn (setq filepath (expand-file-name file (car paths)))
; (not (file-exists-p filepath))))
; (setq paths (cdr paths)))
; (if (and (not (and filepath (file-exists-p filepath)))
; erc-default-sound)
; (setq filepath erc-default-sound))
; (cond ((and filepath (file-exists-p filepath))
;; (start-process "erc-sound" nil erc-play-command filepath)
; (start-process "erc-sound" nil "/bin/tcsh" "-c"
; (concat erc-play-command " " filepath))
; )
; (t (beep)))
; (erc-log (format "Playing sound file %S" filepath))))
(defun erc-toggle-sound (&optional arg)
"Toggles playing sounds on and off. With positive argument,
turns them on. With any other argument turns sounds off."

View File

@ -580,6 +580,11 @@ ARGS are ignored."
(erc-modified-channels-display)
(force-mode-line-update t))))
(defvar erc-track-mouse-face (if (featurep 'xemacs)
'modeline-mousable
'mode-line-highlight)
"The face to use when mouse is over channel names in the mode line.")
(defun erc-make-mode-line-buffer-name (string buffer &optional faces count)
"Return STRING as a button that switches to BUFFER when clicked.
If FACES are provided, color STRING with them."
@ -609,6 +614,12 @@ If FACES are provided, color STRING with them."
(posn-window (event-start e)))
(switch-to-buffer-other-window ,buffer))))
(put-text-property 0 (length name) 'local-map map name)
(put-text-property
0 (length name)
'help-echo (concat "mouse-2: switch to buffer, "
"mouse-3: switch to buffer in other window")
name)
(put-text-property 0 (length name) 'mouse-face erc-track-mouse-face name)
(when (and faces erc-track-use-faces)
(put-text-property 0 (length name) 'face faces name))
name))

View File

@ -33,11 +33,11 @@
;;; Commentary:
;; ERC is an IRC client for Emacs.
;; ERC is a powerful, modular, and extensible IRC client for Emacs.
;; For more information, see the following URLs:
;; * http://sv.gnu.org/projects/erc/
;; * http://www.emacswiki.org/cgi-bin/wiki.pl?EmacsIRCClient
;; * http://www.emacswiki.org/cgi-bin/wiki/ERC
;; As of 2006-06-13, ERC development is now hosted on Savannah
;; (http://sv.gnu.org/projects/erc). I invite everyone who wants to
@ -57,17 +57,17 @@
;; To connect to an IRC server, do
;;
;; M-x erc-select RET
;; M-x erc RET
;;
;; After you are connected to a server, you can use C-h m or have a look at
;; the IRC menu.
;; the ERC menu.
;;; History:
;;
;;; Code:
(defconst erc-version-string "Version 5.1.4"
(defconst erc-version-string "Version 5.2 stable pre-release"
"ERC version. This is used by function `erc-version'.")
(eval-when-compile (require 'cl))
@ -1164,6 +1164,12 @@ See the variable `erc-command-indicator'."
"ERC face for errors."
:group 'erc-faces)
;; same default color as `erc-input-face'
(defface erc-my-nick-face '((t (:bold t :foreground "brown")))
"ERC face for your current nickname in messages sent by you.
See also `erc-show-my-nick'."
:group 'erc-faces)
(defface erc-nick-default-face '((t (:bold t)))
"ERC nickname default face."
:group 'erc-faces)
@ -1316,8 +1322,7 @@ the process buffer."
(process-buffer erc-server-process)))
(defun erc-server-buffer-live-p ()
"Return t if the buffer associated with `erc-server-process'
has not been killed."
"Return t if the server buffer has not been killed."
(and (processp erc-server-process)
(buffer-live-p (process-buffer erc-server-process))))
@ -1433,7 +1438,7 @@ Turning on `erc-mode' runs the hook `erc-mode-hook'."
(defconst erc-default-server "irc.freenode.net"
"IRC server to use if it cannot be detected otherwise.")
(defconst erc-default-port "ircd"
(defconst erc-default-port "6667"
"IRC port to use if it cannot be detected otherwise.")
(defcustom erc-join-buffer 'buffer
@ -1534,7 +1539,7 @@ symbol, it may have these values:
(or target
(with-current-buffer (get-buffer buf-name)
(and (erc-server-buffer-p)
(not erc-server-connected))))
(not (erc-server-process-alive)))))
(with-current-buffer (get-buffer buf-name)
(and (string= erc-session-server server)
(erc-port-equal erc-session-port port))))
@ -1555,7 +1560,8 @@ All strings are compared according to IRC protocol case rules, see
(catch 'result
(while list
(if (string= string (erc-downcase (car list)))
(throw 'result list) (setq list (cdr list))))))
(throw 'result list)
(setq list (cdr list))))))
(defmacro erc-with-buffer (spec &rest body)
"Execute BODY in the buffer associated with SPEC.
@ -1663,7 +1669,7 @@ If `erc-track-mode' is in enabled, put the last element of
Due to some yet unresolved reason, global function `iswitchb-mode'
needs to be active for this function to work."
(interactive "P")
(eval-when-compile
(eval-and-compile
(require 'iswitchb))
(let ((iswitchb-make-buflist-hook
(lambda ()
@ -1671,8 +1677,7 @@ needs to be active for this function to work."
(mapcar 'buffer-name
(erc-buffer-list
nil
(when (and arg (boundp 'erc-server-process))
erc-server-process)))))))
(when arg erc-server-process)))))))
(switch-to-buffer
(iswitchb-read-buffer
"Switch-to: "
@ -1833,9 +1838,10 @@ removed from the list will be disabled."
(condition-case nil
(require (intern req))
(error nil))
(funcall (or (intern-soft (concat "erc-" (symbol-name mod) "-mode"))
(error "`%s' is not a known ERC module" mod))
1))))
(let ((sym (intern-soft (concat "erc-" (symbol-name mod) "-mode"))))
(if (fboundp sym)
(funcall sym 1)
(error "`%s' is not a known ERC module" mod))))))
(defun erc-setup-buffer (buffer)
"Consults `erc-join-buffer' to find out how to display `BUFFER'."
@ -1861,8 +1867,8 @@ removed from the list will be disabled."
(display-buffer buffer)
(switch-to-buffer buffer)))))
(defun erc (&optional server port nick full-name
connect passwd tgt-list channel process)
(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.
@ -1881,6 +1887,7 @@ Returns the buffer for the given server or channel."
(connected-p (unless connect erc-server-connected))
(buffer (erc-get-buffer-create server port channel))
(old-buffer (current-buffer))
(old-point (point))
continued-session)
(erc-update-modules)
(set-buffer buffer)
@ -1959,7 +1966,7 @@ Returns the buffer for the given server or channel."
(insert "\n"))
(set-marker (process-mark erc-server-process) (point))
(if continued-session
(goto-char (point-max))
(goto-char old-point)
(set-marker erc-insert-marker (point))
(erc-display-prompt)
(goto-char (point-max)))
@ -2007,7 +2014,7 @@ If no buffer matches, return nil."
(defcustom erc-before-connect nil
"Hook called before connecting to a server.
This hook gets executed before `erc-select' actually invokes `erc-mode'
This hook gets executed before `erc' actually invokes `erc-mode'
with your input data. The functions in here get called with three
parameters, SERVER, PORT and NICK."
:group 'erc-hooks
@ -2073,11 +2080,11 @@ functions in here get called with the parameters SERVER and NICK."
(list :server server :port port :nick nick :password passwd)))
;;;###autoload
(defun* erc-select (&key (server (erc-compute-server))
(port (erc-compute-port))
(nick (erc-compute-nick))
password
(full-name (erc-compute-full-name)))
(defun* erc (&key (server (erc-compute-server))
(port (erc-compute-port))
(nick (erc-compute-nick))
password
(full-name (erc-compute-full-name)))
"Select connection parameters and run ERC.
Non-interactively, it takes keyword arguments
(server (erc-compute-server))
@ -2088,7 +2095,7 @@ Non-interactively, it takes keyword arguments
That is, if called with
(erc-select :server \"irc.freenode.net\" :full-name \"Harry S Truman\")
(erc :server \"irc.freenode.net\" :full-name \"Harry S Truman\")
server and full-name will be set to those values, whereas
`erc-compute-port', `erc-compute-nick' and `erc-compute-full-name' will
@ -2096,15 +2103,18 @@ be invoked for the values of the other parameters."
(interactive (erc-select-read-args))
(run-hook-with-args 'erc-before-connect server port nick)
(erc server port nick erc-user-full-name t password))
(erc-open server port nick full-name t password))
(defalias 'erc-select 'erc)
(defun erc-select-ssl (&rest r)
(defun erc-ssl (&rest r)
"Interactively select SSL connection parameters and run ERC.
Arguments are as to erc-select."
Arguments are the same as for `erc'."
(interactive (erc-select-read-args))
(let ((erc-server-connect-function 'erc-open-ssl-stream))
(apply 'erc-select r)))
(apply 'erc r)))
(defalias 'erc-select-ssl 'erc-ssl)
(defun erc-open-ssl-stream (name buffer host port)
"Open an SSL stream to an IRC server.
@ -2321,9 +2331,8 @@ If STRING is nil, the function does nothing."
((listp buffer) buffer)
((processp buffer) (list (process-buffer buffer)))
((eq 'all buffer)
(and (boundp 'erc-server-process)
;; Hmm, or all of the same session server?
(erc-buffer-list nil erc-server-process)))
;; Hmm, or all of the same session server?
(erc-buffer-list nil erc-server-process))
((and (eq 'active buffer) (erc-active-buffer))
(list (erc-active-buffer)))
((erc-server-buffer-live-p)
@ -2536,7 +2545,11 @@ therefore has to contain the command itself as well."
"Ignore USER. This should be a regexp matching nick!user@host.
If no USER argument is specified, list the contents of `erc-ignore-list'."
(if user
(progn
(let ((quoted (regexp-quote user)))
(when (and (not (string= user quoted))
(y-or-n-p (format "Use regexp-quoted form (%s) instead? "
quoted)))
(setq user quoted))
(erc-display-line
(erc-make-notice (format "Now ignoring %s" user))
'active)
@ -2554,16 +2567,22 @@ If no USER argument is specified, list the contents of `erc-ignore-list'."
(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)
(erc-member-ignore-case user erc-ignore-list)))))
(if (null ignored-nick)
(erc-member-ignore-case (regexp-quote user)
erc-ignore-list)))))
(unless ignored-nick
(if (setq ignored-nick (erc-ignored-user-p user))
(unless (y-or-n-p (format "Remove this regexp (%s)? "
ignored-nick))
(setq ignored-nick nil))
(erc-display-line
(erc-make-notice (format "%s is not currently ignored!" user))
'active)
'active)))
(when ignored-nick
(erc-display-line
(erc-make-notice (format "No longer ignoring %s" user))
'active))
(with-current-buffer (erc-server-buffer)
(setq erc-ignore-list (delete ignored-nick erc-ignore-list))))
'active)
(with-current-buffer (erc-server-buffer)
(setq erc-ignore-list (delete ignored-nick erc-ignore-list)))))
t)
(defun erc-cmd-CLEAR ()
@ -3149,7 +3168,7 @@ the message given by REASON."
"Connect to SERVER, leaving existing connection intact."
(erc-log (format "cmd: SERVER: %s" server))
(condition-case nil
(erc-select :server server :nick (erc-current-nick))
(erc :server server :nick (erc-current-nick))
(error
(message "Cannot find host %s." server)
(beep)))
@ -3534,9 +3553,8 @@ If `point' is at the beginning of a channel name, use that as default."
(list
(if (and (boundp 'reason) (stringp reason) (not (string= reason "")))
reason
(read-from-minibuffer (concat "Leave " (erc-default-target)
", Reason? ")
(cons "No reason" 0)))))
(read-from-minibuffer (concat "Reason for leaving " (erc-default-target)
": ")))))
(erc-cmd-PART (concat (erc-default-target)" " reason)))
(defun erc-set-topic (topic)
@ -3666,15 +3684,15 @@ To change how this query window is displayed, use `let' to bind
(buffer-live-p server)
(set-buffer server))
(error "Couldn't switch to server buffer"))
(let ((buf (erc erc-session-server
erc-session-port
(erc-current-nick)
erc-session-user-full-name
nil
nil
(list target)
target
erc-server-process)))
(let ((buf (erc-open erc-session-server
erc-session-port
(erc-current-nick)
erc-session-user-full-name
nil
nil
(list target)
target
erc-server-process)))
(unless buf
(error "Couldn't open query window"))
(erc-update-mode-line)
@ -3846,22 +3864,19 @@ and as second argument the event parsed as a vector."
:type 'function)
(defun erc-format-nick (&optional user channel-data)
"Standard nickname formatting function. Only returns the value
of NICK."
(if user
(erc-server-user-nickname user)))
"Return the nickname of USER.
See also `erc-format-nick-function'."
(when user (erc-server-user-nickname user)))
(defun erc-format-@nick (&optional user channel-data)
"Format a nickname such that @ or + are prefix for the NICK
if OP or VOICE are t respectively."
(if user
(let (op voice)
(if channel-data
(setq op (erc-channel-user-op channel-data)
voice (erc-channel-user-voice channel-data)))
(concat (if voice "+" "")
(if op "@" "")
(erc-server-user-nickname user)))))
"Format the nickname of USER showing if USER is an operator or has voice.
Operators have \"@\" and users with voice have \"+\" as a prefix.
Use CHANNEL-DATA to determine op and voice status.
See also `erc-format-nick-function'."
(when user
(let ((op (and channel-data (erc-channel-user-op channel-data) "@"))
(voice (and channel-data (erc-channel-user-voice channel-data) "+")))
(concat voice op (erc-server-user-nickname user)))))
(defun erc-format-my-nick ()
"Return the beginning of this user's message, correctly propertized"
@ -3871,7 +3886,7 @@ if OP or VOICE are t respectively."
(nick (erc-current-nick)))
(concat
(erc-propertize open 'face 'erc-default-face)
(erc-propertize nick 'face 'erc-nick-default-face)
(erc-propertize nick 'face 'erc-my-nick-face)
(erc-propertize close 'face 'erc-default-face)))
(let ((prefix "> "))
(erc-propertize prefix 'face 'erc-default-face))))
@ -4548,7 +4563,7 @@ TOPIC string to the current topic."
;; list of triples: (mode-char 'on/'off argument)
(arg-modes (nth 2 modes)))
(cond ((erc-channel-p tgt); channel modes
(let ((buf (and (boundp 'erc-server-process) erc-server-process
(let ((buf (and erc-server-process
(erc-get-buffer tgt erc-server-process))))
(when buf
(with-current-buffer buf
@ -4640,7 +4655,7 @@ person who changed the modes."
(arg-modes (nth 2 modes)))
;; now parse the modes changes and do the updates
(cond ((erc-channel-p tgt); channel modes
(let ((buf (and (boundp 'erc-server-process) erc-server-process
(let ((buf (and erc-server-process
(erc-get-buffer tgt erc-server-process))))
(when buf
;; FIXME! This used to have an original buffer
@ -5059,10 +5074,10 @@ The previous default target of QUERY type gets removed"
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."
(dolist (ignored (with-current-buffer (erc-server-buffer) erc-ignore-list))
(if (string-match ignored spec)
;; We have `require'd cl, so we can return from the block named nil
(return ignored))))
(catch 'found
(dolist (ignored (with-current-buffer (erc-server-buffer) erc-ignore-list))
(if (string-match ignored spec)
(throw 'found ignored)))))
(defun erc-ignored-reply-p (msg tgt proc)
;; FIXME: this docstring needs fixing -- Lawrence 2004-01-08
@ -5418,7 +5433,7 @@ Sets the buffer local variables:
This tries a number of increasingly more default methods until a
non-nil value is found.
- SERVER (the argument passwd to this function)
- SERVER (the argument passed to this function)
- The `erc-server' option
- The value of the IRCSERVER environment variable
- The `erc-default-server' variable"
@ -5833,10 +5848,12 @@ P may be an integer or a service name."
(defun erc-string-to-port (s)
"Convert string S to either an integer port number or a service name."
(let ((n (string-to-number s)))
(if (= n 0)
s
n)))
(if (numberp s)
s
(let ((n (string-to-number s)))
(if (= n 0)
s
n))))
(defun erc-version (&optional here)
"Show the version number of ERC in the minibuffer.
@ -5886,8 +5903,8 @@ If optional argument HERE is non-nil, insert version number at point."
All windows are opened in the current frame."
(interactive)
(unless (boundp 'erc-server-process)
(error "No erc-process found in current buffer"))
(unless erc-server-process
(error "No erc-server-process found in current buffer"))
(let ((bufs (erc-buffer-list nil erc-server-process)))
(when bufs
(delete-other-windows)
@ -6019,7 +6036,8 @@ All windows are opened in the current frame."
(s341 . "Inviting %n to channel %c")
(s352 . "%-11c %-10n %-4a %u@%h (%f)")
(s353 . "Users on %c: %u")
(s367 . "Ban on %b on %c set by %s on %t (Use /banlist!)")
(s367 . "Ban for %b on %c")
(s367-set-by . "Ban for %b on %c set by %s on %t")
(s368 . "Banlist of %c ends.")
(s379 . "%c: Forwarded to %f")
(s391 . "The time at %s is %t")
@ -6194,10 +6212,10 @@ Otherwise, connect to HOST:PORT as USER and /join CHANNEL."
(with-current-buffer (or server-buffer (current-buffer))
(if (and server-buffer channel)
(erc-cmd-JOIN channel)
(erc host port (or user (erc-compute-nick)) (erc-compute-full-name)
(not server-buffer) password nil channel
(when server-buffer
(get-buffer-process server-buffer)))))))
(erc-open host port (or user (erc-compute-nick)) (erc-compute-full-name)
(not server-buffer) password nil channel
(when server-buffer
(get-buffer-process server-buffer)))))))
(provide 'erc)

View File

@ -1,3 +1,7 @@
2006-11-20 Michael Olson <mwolson@gnu.org>
* erc.texi: Call this the 5.2 stable pre-release of ERC.
2006-11-18 Chong Yidong <cyd@stupidchicken.com>
* misc.texi (Interactive Shell): INSIDE_EMACS is set to t,

View File

@ -12,7 +12,7 @@
@syncodeindex fn cp
@copying
This manual is for ERC version 5.1.4.
This manual is for ERC version 5.2 stable pre-release.
Copyright @copyright{} 2005, 2006 Free Software Foundation, Inc.
@ -271,7 +271,7 @@ itself. An example follows.
(require 'erc)
@end lisp
Once ERC is loaded, the command @kbd{M-x erc-select} will start ERC and
Once ERC is loaded, the command @kbd{M-x erc} will start ERC and
prompt for the server to connect to.
@c PRE5_2: Sample session, including:
@ -520,11 +520,11 @@ Translate morse code in messages
@section Connecting to an IRC Server
@cindex connecting
The easiest way to connect to an IRC server is to call
@kbd{M-x erc-select}. If you want to assign this function to a
keystroke, the following will help you figure out its parameters.
The easiest way to connect to an IRC server is to call @kbd{M-x erc}.
If you want to assign this function to a keystroke, the following will
help you figure out its parameters.
@defun erc-select
@defun erc
Select connection parameters and run ERC.
Non-interactively, it takes the following keyword arguments.
@ -543,7 +543,7 @@ That is, if called with the following arguments, @var{server} and
parameters.
@example
(erc-select :server "irc.freenode.net" :full-name "Harry S Truman")
(erc :server "irc.freenode.net" :full-name "Harry S Truman")
@end example
@end defun