irc - new log file name format

This commit is contained in:
Kashish Sharma 2016-09-28 18:21:58 +05:30
parent 96838736fc
commit 6dfa70b1d8
1 changed files with 25 additions and 2 deletions

View File

@ -26,11 +26,29 @@
("oftc" "#debian-next")))
(with-eval-after-load 'erc
(defun cp-erc-generate-log-file-name (buffer target nick server port)
"Generates a log-file name using only the channel and network
names rather than server name. This results in a file name of the
form irc.NETWORK.#CHANNEL.erclog. This function is a possible
value for `erc-generate-log-file-name-function'."
(require 'erc-networks)
(let ((file (concat
(erc-compute-server)
;; "irc."
;; (or (with-current-buffer buffer (erc-network-name)) server)
;; (if target (concat target "!"))
"."
target
".erclog")))
;; we need a make-safe-file-name function.
(convert-standard-filename file)))
(setq ;; erc-default-coding-system 'utf-8
erc-password "trololo_trololo"
erc-fill-mode nil
erc-generate-log-file-name-function 'erc-generate-log-file-name-network
erc-generate-log-file-name-function 'cp-erc-generate-log-file-name
;; erc-generate-log-file-name-function 'erc-generate-log-file-name-network
erc-log-channels-directory "~/.emacs.d/erc/logs/"
erc-log-mode t
erc-save-buffer-on-part nil
@ -106,8 +124,10 @@
"font-lock-comment-face")
(highlight-lines-matching-regexp "^\*\*\*.*\(join\|quit\|part\)"
"font-lock-comment-face"))
;; (add-to-list 'auto-mode-alist
;; (cons "/erc/logs/" 'erc-log-read-mode))
(add-to-list 'auto-mode-alist
(cons "/erc/logs/" 'erc-log-read-mode))
(cons ".erclog$" 'erc-log-read-mode))
(with-eval-after-load 'rcirc
(setq
@ -124,3 +144,6 @@
rcirc-default-nick "contrapunctus"
;; rcirc-coding-system-alist '(("" . 'utf-8))
))
;; TODO
;; open log file for current channel