Skip to content

Instantly share code, notes, and snippets.

@Raynes
Created December 5, 2011 15:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Raynes/1434060 to your computer and use it in GitHub Desktop.
Save Raynes/1434060 to your computer and use it in GitHub Desktop.
;; ERC
(require 'znc)
(global-set-key (kbd "C-c z") 'znc-all)
(defun get-string-from-file (filePath)
"Return FILEPATH's file content."
(with-temp-buffer
(insert-file-contents filePath)
(buffer-string)))
(setq znc-servers (read (get-string-from-file "~/.ercznc")))
(require 'todochiku)
(defun highlight-me (match-type nick message)
(unless (posix-string-match "^\\** Users on #" message)
(todochiku-message
(concat "ERC: Highlight on " (buffer-name (current-buffer)))
(concat "<" (first (split-string nick "!")) "> " message)
"")))
(add-hook 'erc-text-matched-hook 'highlight-me)
(add-hook 'erc-text-matched-hook 'erc-beep-on-match)
(setq erc-track-exclude-types
'("JOIN" "NICK" "PART" "QUIT" "MODE" "KICK"
"324" "329" "332" "333" "353" "477"))
(setq erc-track-switch-direction 'newest)
(setq erc-timestamp-format "%H:%M")
(erc-spelling-mode 1)
(setq erc-log-channels-directory "~/.erc/logs/")
(erc-log-mode 1)
(defun current-itunes-song ()
(do-applescript
"tell application \"iTunes\"
set artist_name to the artist of the current track
set song_title to the name of the current track
set song_album to the album of the current track
set song_length to the time of the current track
set played_count to the played count of the current track
return song_title & \" - \" & artist_name & \" [\" & song_album & \"] [length: \" & song_length & \"] [played: \" & played_count & \"]\"
end tell"))
(defun erc-cmd-NP ()
(erc-cmd-ME (concat " is listening to " (current-itunes-song))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment