summaryrefslogtreecommitdiff
path: root/lisp/erc
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/erc')
-rw-r--r--lisp/erc/ChangeLog75
-rw-r--r--lisp/erc/erc-backend.el26
-rw-r--r--lisp/erc/erc-log.el41
-rw-r--r--lisp/erc/erc-match.el2
-rw-r--r--lisp/erc/erc-spelling.el14
-rw-r--r--lisp/erc/erc.el51
6 files changed, 153 insertions, 56 deletions
diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog
index 216d14d0aa6..72754aa1cd3 100644
--- a/lisp/erc/ChangeLog
+++ b/lisp/erc/ChangeLog
@@ -1,3 +1,78 @@
+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-07 Michael Olson <mwolson@gnu.org>
+
+ * erc-backend.el (erc-process-sentinel-1): Use erc-display-message
+ in several places instead of inserting text.
+ (erc-process-sentinel): Move to the input-marker before removing
+ the prompt.
+
+ * erc.el (erc-port): Fix customization options.
+ (erc-display-message): Handle null type explicitly. Previously,
+ this was relying on a chance side-effect. Cosmetic indentation
+ tweak.
+ (english): Add 'finished and 'terminated entries to the catalog.
+ Add initial and terminal newlines to 'disconnected and
+ 'disconnected-noreconnect entries. Avoid long lines.
+
+2006-08-06 Michael Olson <mwolson@gnu.org>
+
+ * erc.el (erc-arrange-session-in-multiple-windows): Fix bug with
+ multi-tty Emacs.
+ (erc-select-startup-file): Fix bug introduced by recent change.
+
+2006-08-05 Michael Olson <mwolson@gnu.org>
+
+ * erc-log.el (erc-log-standardize-name): New function that returns
+ a filename that is safe for use for a log file.
+ (erc-current-logfile): Use it.
+
+ * erc.el (erc-startup-file-list): Search in ~/.emacs.d first,
+ since that is a fairly standard directory.
+ (erc-select-startup-file): Re-write to use
+ convert-standard-filename, which will ensure that MS-DOS systems
+ look for the _ercrc.el file.
+
+2006-08-02 Michael Olson <mwolson@gnu.org>
+
+ * erc.el (erc-version-string): Release ERC 5.1.4.
+
+ * Makefile, NEWS, erc.texi: Update for the 5.1.4 release.
+
+ * erc.el (erc-active-buffer): Fix bug that caused messages to go
+ to the wrong buffer. Thanks to offby1 for the report.
+
+ * erc-backend.el (erc-coding-system-for-target): Handle case where
+ target is nil. Thanks to Kai Fan for the patch.
+
+2006-07-29 Michael Olson <mwolson@gnu.org>
+
+ * erc-log.el (erc-log-setup-logging): Don't offer to save the
+ buffer. It will be saved automatically killed. Thanks to Johan
+ Bockgård and Tassilo Horn for pointing this out.
+
+2006-07-27 Johan Bockgård <bojohan@users.sourceforge.net>
+
+ * erc.el (define-erc-module): Make find-function and find-variable
+ find the names constructed by `define-erc-module' in Emacs 22.
+
+2006-07-14 Michael Olson <mwolson@gnu.org>
+
+ * erc-log.el (log): Make sure that we enable logging on
+ already-opened buffers as well, in case the user toggles this
+ module after loading ERC. Also be sure to remove logging ability
+ from all ERC buffers when the module is disabled.
+ (erc-log-setup-logging): Set buffer-file-name to nil rather than
+ the empty string. This should fix some errors that occur when
+ quitting Emacs without first killing all ERC buffers.
+ (erc-log-disable-logging): New function that removes the logging
+ ability from the current buffer.
+
+ * erc-spelling.el (spelling): Use dolist and buffer-live-p.
+
2006-07-12 Michael Olson <mwolson@gnu.org>
* erc-match.el (erc-log-matches): Bind inhibit-read-only rather
diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el
index 7dce9e4bf01..5acbcb05ab8 100644
--- a/lisp/erc/erc-backend.el
+++ b/lisp/erc/erc-backend.el
@@ -493,11 +493,7 @@ action."
(if erc-server-quitting
;; normal quit
(progn
- (let ((string "\n\n*** ERC finished ***\n")
- (inhibit-read-only t))
- (erc-put-text-property 0 (length string)
- 'face 'erc-error-face string)
- (insert string))
+ (erc-display-message nil 'error (current-buffer) 'finished)
(when erc-kill-server-buffer-on-quit
(set-buffer-modified-p nil)
(kill-buffer (current-buffer))))
@@ -519,12 +515,8 @@ action."
(erc erc-session-server erc-session-port erc-server-current-nick
erc-session-user-full-name t erc-session-password)
;; terminate, do not reconnect
- (let ((string (concat "\n\n*** ERC terminated: " event
- "\n"))
- (inhibit-read-only t))
- (erc-put-text-property 0 (length string)
- 'face 'erc-error-face string)
- (insert string)))))
+ (erc-display-message nil 'error (current-buffer)
+ 'terminated ?e event))))
(defun erc-process-sentinel (cproc event)
"Sentinel function for ERC process."
@@ -545,6 +537,7 @@ action."
(run-hook-with-args 'erc-disconnected-hook
(erc-current-nick) (system-name) "")
;; Remove the prompt
+ (goto-char (or (marker-position erc-input-marker) (point-max)))
(forward-line 0)
(erc-remove-text-properties-region (point) (point-max))
(delete-region (point) (point-max))
@@ -563,11 +556,12 @@ action."
"Return the coding system or cons cell appropriate for TARGET.
This is determined via `erc-encoding-coding-alist' or
`erc-server-coding-system'."
- (or (let ((case-fold-search t))
- (catch 'match
- (dolist (pat erc-encoding-coding-alist)
- (when (string-match (car pat) target)
- (throw 'match (cdr pat))))))
+ (or (when target
+ (let ((case-fold-search t))
+ (catch 'match
+ (dolist (pat erc-encoding-coding-alist)
+ (when (string-match (car pat) target)
+ (throw 'match (cdr pat)))))))
(and (functionp erc-server-coding-system)
(funcall erc-server-coding-system))
erc-server-coding-system))
diff --git a/lisp/erc/erc-log.el b/lisp/erc/erc-log.el
index b316a8588bd..2fe29e82fe5 100644
--- a/lisp/erc/erc-log.el
+++ b/lisp/erc/erc-log.el
@@ -71,8 +71,6 @@
;; markers.
;;; TODO:
-;; * Erc needs a generalised make-safe-file-name function, so that
-;; generated file names don't contain any invalid file characters.
;;
;; * Really, we need to lock the logfiles somehow, so that if a user
;; is running multiple emacsen and/or on the same channel as more
@@ -218,7 +216,10 @@ also be a predicate function. To only log when you are not set away, use:
(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
- (add-hook 'erc-connect-pre-hook 'erc-log-setup-logging 'append))
+ (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)))))
;; disable
((remove-hook 'erc-insert-post-hook 'erc-save-buffer-in-logs)
(remove-hook 'erc-send-post-hook 'erc-save-buffer-in-logs)
@@ -226,7 +227,10 @@ also be a predicate function. To only log when you are not set away, use:
(remove-hook 'erc-kill-channel-hook 'erc-save-buffer-in-logs)
(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)))
+ (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))))))
(define-key erc-mode-map "\C-c\C-l" 'erc-save-buffer-in-logs)
@@ -236,8 +240,7 @@ also be a predicate function. To only log when you are not set away, use:
This function is destined to be run from `erc-connect-pre-hook'."
(when (erc-logging-enabled)
(auto-save-mode -1)
- (setq buffer-offer-save t
- buffer-file-name "")
+ (setq buffer-file-name nil)
(set (make-local-variable 'write-file-functions)
'(erc-save-buffer-in-logs))
(when erc-log-insert-log-on-open
@@ -245,6 +248,12 @@ This function is destined to be run from `erc-connect-pre-hook'."
(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-all-but-server-buffers (buffer)
"Returns t if logging should be enabled in BUFFER.
Returns nil iff `erc-server-buffer-p' returns t."
@@ -282,17 +291,27 @@ is writeable (it will be created as necessary) and
(funcall erc-enable-logging (or buffer (current-buffer)))
erc-enable-logging)))
+(defun erc-log-standardize-name (filename)
+ "Make FILENAME safe to use as the name of an ERC log.
+This will not work with full paths, only names.
+
+Any unsafe characters in the name are replaced with \"!\". The
+filename is downcased."
+ (downcase (erc-replace-regexp-in-string
+ "[/\\]" "!" (convert-standard-filename filename))))
+
(defun erc-current-logfile (&optional buffer)
"Return the logfile to use for BUFFER.
If BUFFER is nil, the value of `current-buffer' is used.
This is determined by `erc-generate-log-file-name-function'.
The result is converted to lowercase, as IRC is case-insensitive"
(expand-file-name
- (downcase (funcall erc-generate-log-file-name-function
- (or buffer (current-buffer))
- (or (erc-default-target) (buffer-name buffer))
- (erc-current-nick)
- erc-session-server erc-session-port))
+ (erc-log-standardize-name
+ (funcall erc-generate-log-file-name-function
+ (or buffer (current-buffer))
+ (or (erc-default-target) (buffer-name buffer))
+ (erc-current-nick)
+ erc-session-server erc-session-port))
erc-log-channels-directory))
(defun erc-generate-log-file-name-with-date (buffer &rest ignore)
diff --git a/lisp/erc/erc-match.el b/lisp/erc/erc-match.el
index ffbc7482aae..b5dc913a8c4 100644
--- a/lisp/erc/erc-match.el
+++ b/lisp/erc/erc-match.el
@@ -566,7 +566,7 @@ deactivate/activate match logging in the latter. See
(unless buffer-already
(insert " == Type \"q\" to dismiss messages ==\n")
(erc-view-mode-enter nil (lambda (buffer)
- (when (y-or-n-p "Discard messages?")
+ (when (y-or-n-p "Discard messages? ")
(kill-buffer buffer)))))
buffer)))
diff --git a/lisp/erc/erc-spelling.el b/lisp/erc/erc-spelling.el
index 3cbc786274d..7ed0f510539 100644
--- a/lisp/erc/erc-spelling.el
+++ b/lisp/erc/erc-spelling.el
@@ -40,15 +40,13 @@
;; Use erc-connect-pre-hook instead of erc-mode-hook as pre-hook is
;; called AFTER the server buffer is initialized.
((add-hook 'erc-connect-pre-hook 'erc-spelling-init)
- (mapc (lambda (buffer)
- (when buffer
- (with-current-buffer buffer (erc-spelling-init))))
- (erc-buffer-list)))
+ (dolist (buffer (erc-buffer-list))
+ (when (buffer-live-p buffer)
+ (with-current-buffer buffer (erc-spelling-init)))))
((remove-hook 'erc-connect-pre-hook 'erc-spelling-init)
- (mapc (lambda (buffer)
- (when buffer
- (with-current-buffer buffer (flyspell-mode 0))))
- (erc-buffer-list))))
+ (dolist (buffer (erc-buffer-list))
+ (when (buffer-live-p buffer)
+ (with-current-buffer buffer (flyspell-mode 0))))))
(defcustom erc-spelling-dictionaries nil
"An alist mapping buffer names to dictionaries.
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index fd5a49eae4b..41d59576251 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -67,7 +67,7 @@
;;; Code:
-(defconst erc-version-string "Version 5.1.3"
+(defconst erc-version-string "Version 5.1.4"
"ERC version. This is used by function `erc-version'.")
(eval-when-compile (require 'cl))
@@ -157,8 +157,8 @@ parameters and authentication."
This can be either a string or a number."
:group 'erc
:type '(choice (const :tag "None" nil)
- (const :tag "Port number" number)
- (const :tag "Port string" string)))
+ (integer :tag "Port number")
+ (string :tag "Port string")))
(defcustom erc-nick nil
"Nickname to use if one is not provided.
@@ -822,7 +822,8 @@ See `erc-server-flood-margin' for other flood-related parameters.")
;; Script parameters
(defcustom erc-startup-file-list
- '("~/.ercrc.el" "~/.ercrc" ".ercrc.el" ".ercrc")
+ '("~/.emacs.d/.ercrc.el" "~/.emacs.d/.ercrc"
+ "~/.ercrc.el" "~/.ercrc" ".ercrc.el" ".ercrc")
"List of files to try for a startup script.
The first existent and readable one will get executed.
@@ -1243,7 +1244,11 @@ With arg, turn ERC %S mode on if and only if arg is positive.
(format "erc-%s-mode"
(downcase (symbol-name alias)))))
(quote
- ,mode))))))
+ ,mode)))
+ ;; For find-function and find-variable.
+ (put ',mode 'definition-name ',name)
+ (put ',enable 'definition-name ',name)
+ (put ',disable 'definition-name ',name))))
(put 'define-erc-module 'doc-string-elt 3)
@@ -1388,8 +1393,8 @@ server buffer")
Defaults to the server buffer."
(with-current-buffer (erc-server-buffer)
(if (buffer-live-p erc-active-buffer)
- erc-active-buffer)
- (setq erc-active-buffer (current-buffer))))
+ erc-active-buffer
+ (setq erc-active-buffer (current-buffer)))))
(defun erc-set-active-buffer (buffer)
"Set the value of `erc-active-buffer' to BUFFER."
@@ -2358,6 +2363,8 @@ See also `erc-format-message' and `erc-display-line'."
msg)))
(setq string
(cond
+ ((null type)
+ string)
((listp type)
(mapc (lambda (type)
(setq string
@@ -2370,7 +2377,7 @@ See also `erc-format-message' and `erc-display-line'."
(if (not (erc-response-p parsed))
(erc-display-line string buffer)
(unless (member (erc-response.command parsed) erc-hide-list)
- (erc-put-text-property 0 (length string) 'erc-parsed parsed string)
+ (erc-put-text-property 0 (length string) 'erc-parsed parsed string)
(erc-put-text-property 0 (length string) 'rear-sticky t string)
(erc-display-line string buffer)))))
@@ -5237,13 +5244,11 @@ If FILE is found, return the path to it."
(defun erc-select-startup-file ()
"Select an ERC startup file.
See also `erc-startup-file-list'."
- (let ((l erc-startup-file-list)
- (f nil))
- (while (and (not f) l)
- (if (file-readable-p (car l))
- (setq f (car l)))
- (setq l (cdr l)))
- f))
+ (catch 'found
+ (dolist (f erc-startup-file-list)
+ (setq f (convert-standard-filename f))
+ (when (file-readable-p f)
+ (throw 'found f)))))
(defun erc-find-script-file (file)
"Search for FILE in `default-directory', and any in `erc-script-path'."
@@ -5890,7 +5895,8 @@ All windows are opened in the current frame."
(setq bufs (cdr bufs))
(while bufs
(split-window)
- (switch-to-buffer-other-window (car bufs))
+ (other-window 1)
+ (switch-to-buffer (car bufs))
(setq bufs (cdr bufs))
(balance-windows)))))
@@ -5942,12 +5948,17 @@ All windows are opened in the current frame."
(ctcp-request-to . "==> CTCP request from %n (%u@%h) to %t: %r")
(ctcp-too-many . "Too many CTCP queries in single message. Ignoring")
(flood-ctcp-off . "FLOOD PROTECTION: Automatic CTCP responses turned off.")
- (flood-strict-mode . "FLOOD PROTECTION: Switched to Strict Flood Control mode.")
- (disconnected . "Connection failed! Re-establishing connection...")
- (disconnected-noreconnect . "Connection failed! Not re-establishing connection.")
+ (flood-strict-mode
+ . "FLOOD PROTECTION: Switched to Strict Flood Control mode.")
+ (disconnected . "\n\nConnection failed! Re-establishing connection...\n")
+ (disconnected-noreconnect
+ . "\n\nConnection failed! Not re-establishing connection.\n")
+ (finished . "\n\n*** ERC finished ***\n")
+ (terminated . "\n\n*** ERC terminated: %e\n")
(login . "Logging in as \'%n\'...")
(nick-in-use . "%n is in use. Choose new nickname: ")
- (nick-too-long . "WARNING: Nick length (%i) exceeds max NICKLEN(%l) defined by server")
+ (nick-too-long
+ . "WARNING: Nick length (%i) exceeds max NICKLEN(%l) defined by server")
(no-default-channel . "No default channel")
(no-invitation . "You've got no invitation")
(no-target . "No target")