changeset 72301:0bacf06559e2

Update from erc--emacs--22 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-386 Creator: Michael Olson <mwolson@gnu.org>
author Miles Bader <miles@gnu.org>
date Mon, 07 Aug 2006 07:43:25 +0000
parents 0b8053e535c7
children ddc702799326
files lisp/erc/ChangeLog lisp/erc/erc-log.el lisp/erc/erc.el
diffstat 3 files changed, 41 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/erc/ChangeLog	Sun Aug 06 14:23:55 2006 +0000
+++ b/lisp/erc/ChangeLog	Mon Aug 07 07:43:25 2006 +0000
@@ -1,3 +1,20 @@
+2006-08-06  Michael Olson  <mwolson@gnu.org>
+
+	* erc.el (erc-arrange-session-in-multiple-windows): Fix bug with
+	multi-tty Emacs.
+
+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.
--- a/lisp/erc/erc-log.el	Sun Aug 06 14:23:55 2006 +0000
+++ b/lisp/erc/erc-log.el	Mon Aug 07 07:43:25 2006 +0000
@@ -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
@@ -293,17 +291,27 @@
 	   (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)
--- a/lisp/erc/erc.el	Sun Aug 06 14:23:55 2006 +0000
+++ b/lisp/erc/erc.el	Mon Aug 07 07:43:25 2006 +0000
@@ -822,7 +822,8 @@
 ;; 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.
 
@@ -5241,13 +5242,11 @@
 (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-file-name 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'."
@@ -5894,7 +5893,8 @@
       (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)))))