From 7521fd8b341421beb784ba5dc69f5651336bc522 Mon Sep 17 00:00:00 2001 From: Abdo Roig-Maranges Date: Thu, 3 Mar 2016 03:47:16 +0100 Subject: [PATCH] Fix rcirc logging where the channel name has '/' in it This happens when connecting to gitter via irc.gitter.im, for instance. It turns out that channels are named like #syl20bnr/spacemacs. For the logging to work, we need to create the directory #syl20bnr first. --- layers/+irc/rcirc/packages.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/layers/+irc/rcirc/packages.el b/layers/+irc/rcirc/packages.el index 3a51c6dda7ca..52e77db5c3ef 100644 --- a/layers/+irc/rcirc/packages.el +++ b/layers/+irc/rcirc/packages.el @@ -125,8 +125,6 @@ (setq rcirc-log-flag t) (defun rcirc-write-log (process sender response target text) (when rcirc-log-directory - (when (not (file-directory-p rcirc-log-directory)) - (make-directory rcirc-log-directory)) (with-temp-buffer ;; Sometimes TARGET is a buffer :-( (when (bufferp target) @@ -140,9 +138,12 @@ (insert "/" (downcase response) " ")) (insert text "\n") ;; Append the line to the appropriate logfile. - (let ((coding-system-for-write 'no-conversion)) + (let ((coding-system-for-write 'no-conversion) + (logfile (concat rcirc-log-directory (downcase target)))) + (when (not (file-directory-p (file-name-directory logfile))) + (make-directory (file-name-directory logfile))) (write-region (point-min) (point-max) - (concat rcirc-log-directory (downcase target)) + logfile t 'quietly)))))) (add-hook 'rcirc-print-hooks 'rcirc-write-log)