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 Apr 5, 2016
1 parent fdf73e9 commit 54755d6
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions layers/+chat/rcirc/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,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 @@ -143,9 +141,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 54755d6

Please sign in to comment.