]> code.delx.au - gnu-emacs/blobdiff - lisp/erc/erc-log.el
Update docs for `customize-mode'
[gnu-emacs] / lisp / erc / erc-log.el
index aa6b332eb90174095ebc6ae4acfeb4b7c61bfd71..61a83b1739ddf78fc60f906edd84caed2dcc7e49 100644 (file)
@@ -1,9 +1,9 @@
 ;;; erc-log.el --- Logging facilities for ERC.
 
-;; Copyright (C) 2003-2012 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2016 Free Software Foundation, Inc.
 
 ;; Author: Lawrence Mitchell <wence@gmx.li>
-;; Maintainer: FSF
+;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: IRC, chat, client, Internet, logging
 
 ;; Created 2003-04-26
@@ -93,9 +93,7 @@
 ;;; Code:
 
 (require 'erc)
-(eval-when-compile
-  (require 'erc-networks)
-  (require 'cl))
+(eval-when-compile (require 'erc-networks))
 
 (defgroup erc-log nil
   "Logging facilities for ERC."
@@ -114,12 +112,12 @@ If you want to write logs into different directories, make a
 custom function which returns the directory part and set
 `erc-log-channels-directory' to its name."
   :group 'erc-log
-  :type '(choice (const :tag "#channel!nick <at> server:port.txt"
+  :type '(choice (const :tag "#channel!nick@server:port.txt"
                        erc-generate-log-file-name-long)
-                (const :tag "#channel!nick <at> network.txt"
+                (const :tag "#channel!nick@network.txt"
                        erc-generate-log-file-name-network)
                 (const :tag "#channel.txt" erc-generate-log-file-name-short)
-                (const :tag "#channel <at> date.txt"
+                (const :tag "#channel@date.txt"
                        erc-generate-log-file-name-with-date)
                 (function :tag "Other function")))
 
@@ -204,6 +202,7 @@ If you set this to nil, you may want to enable both
 
 This should ideally, be a \"catch-all\" coding system, like
 `emacs-mule', or `iso-2022-7bit'."
+  :type 'coding-system
   :group 'erc-log)
 
 (defcustom erc-log-filter-function nil
@@ -271,9 +270,12 @@ The current buffer is given by BUFFER."
       (setq buffer-file-name nil)
       (erc-set-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))))))))
+       (ignore-errors
+         (save-excursion
+           (goto-char (point-min))
+           (insert-file-contents (erc-current-logfile)))
+         (move-marker erc-last-saved-position
+                      (1- (point-max))))))))
 
 (defun erc-log-disable-logging (buffer)
   "Disable logging in BUFFER."
@@ -380,6 +382,8 @@ 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)))
 
+(declare-function erc-network-name "erc-networks" ())
+
 (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.
@@ -429,7 +433,8 @@ You can save every individual message by putting this function on
                                        file t 'nomessage))))
                  (let ((coding-system-for-write coding-system))
                    (write-region start end file t 'nomessage))))
-             (if (and erc-truncate-buffer-on-save (interactive-p))
+             (if (and erc-truncate-buffer-on-save
+                      (called-interactively-p 'interactive))
                  (progn
                    (let ((inhibit-read-only t)) (erase-buffer))
                    (move-marker erc-last-saved-position (point-max))