Skip to content

Commit

Permalink
Fix rcirc logging where the channel name has '/' in it
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
aroig committed Mar 3, 2016
1 parent 0ca7389 commit 7521fd8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions layers/+irc/rcirc/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)

Expand Down

0 comments on commit 7521fd8

Please sign in to comment.