[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Erc-commit] [commit][emacs22] erc-log: Add choice to have log files wit
From: |
mwolson |
Subject: |
[Erc-commit] [commit][emacs22] erc-log: Add choice to have log files with network name |
Date: |
Sun, 14 Oct 2007 00:48:52 -0400 |
commit 4b9938ebb97b0324745132378dad024d8747ad20
Author: Michael Olson <address@hidden>
Date: Fri Mar 30 01:36:59 2007 +0000
erc-log: Add choice to have log files with network name
2007-03-30 Michael Olson <address@hidden>
* erc-log.el: Avoid compiler warning by requiring erc-network
during compilation.
(erc-generate-log-file-name-function): Add tag to each option.
Add erc-generate-log-file-name-network.
(erc-generate-log-file-name-network): New function which generates
a log file name that uses network name rather than server name,
when possible.
git-archimport-id: address@hidden/erc--main--0--patch-123
diff --git a/ChangeLog b/ChangeLog
index 7da64ba..82ecfb4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,14 @@
* erc-autoaway.el (erc-autoaway-idle-method): Use `if' rather than
`cond' and `set' rather than `set-default'.
+ * erc-log.el: Avoid compiler warning by requiring erc-network
+ during compilation.
+ (erc-generate-log-file-name-function): Add tag to each option.
+ Add erc-generate-log-file-name-network.
+ (erc-generate-log-file-name-network): New function which generates
+ a log file name that uses network name rather than server name,
+ when possible.
+
* erc-track.el (track): Assimilate track-when-active module, since
there's no need to have two modules in one file -- an option will
do. Remove track-modified-channels alias.
diff --git a/erc-log.el b/erc-log.el
index 053bb37..9801192 100644
--- a/erc-log.el
+++ b/erc-log.el
@@ -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."
@@ -347,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 address@hidden
+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.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Erc-commit] [commit][emacs22] erc-log: Add choice to have log files with network name,
mwolson <=