7d77a8a00a2b

Lots from the past week or so.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Wed, 19 Oct 2011 14:35:48 -0400
parents 1b6ffba66e9f
children 00cfa7ffb0dd
branches/tags (none)
files .gitconfig .hgsub .hgsubstate .zshrc dotcss/github.com.css vim/.vimrc vim/colors/molokai.vim weechat/python/autoload/colon_complete.py weechat/python/autoload/growl.py weechat/weechat.conf

Changes

--- a/.gitconfig	Tue Oct 11 09:09:18 2011 -0400
+++ b/.gitconfig	Wed Oct 19 14:35:48 2011 -0400
@@ -13,7 +13,7 @@
 
     pull = pull --ff-only
     merge = merge --no-ff
-    upbranch = merge --ff-only
+    up = merge --ff-only
 
     ci = commit
     cm = commit -m
@@ -27,12 +27,13 @@
     uns = reset HEAD
 
     fo = fetch origin
+    fu = fetch upstream
     po = push origin
     lo = pull origin
     moo = merge origin/ongoing
 
 [push]
-    default = current
+	default = current
 
 [color]
     branch = auto
--- a/.hgsub	Tue Oct 11 09:09:18 2011 -0400
+++ b/.hgsub	Wed Oct 19 14:35:48 2011 -0400
@@ -27,5 +27,6 @@
 vim/bundle/hammer = [git]git://github.com/robgleeson/hammer.vim.git
 vim/bundle/fugitive = [git]git://github.com/tpope/vim-fugitive.git
 vim/bundle/nosecompiler = [git]git://github.com/olethanh/Vim-nosecompiler.git
+vim/bundle/AnsiEsc.vim = [git]git://github.com/vim-scripts/AnsiEsc.vim.git
 
 keymando/Plugins/abbrev = [git]git://github.com/keymando/abbrev.git
--- a/.hgsubstate	Tue Oct 11 09:09:18 2011 -0400
+++ b/.hgsubstate	Wed Oct 19 14:35:48 2011 -0400
@@ -1,9 +1,10 @@
 c711681883f3419b85494e3b285b988e8e2dcbca keymando/Plugins/abbrev
 c060c94622e92e091b2c67499fdda16d91b68c01 mercurial/templates
+d2bb7878622e4c16203acf1c92a0f4bc7ac58003 vim/bundle/AnsiEsc.vim
 a41d5d52c39a31128e969e69acf800b198cb07f9 vim/bundle/ack
 bfdf714f8ea10a6bcba7a1375a5700b11077dcd9 vim/bundle/command-t
 cdecdc56f938840cad250aecd58c1901f04c4d1b vim/bundle/easymotion
-201bdd0eff4cd79847cf006f143deb62f8f97342 vim/bundle/fugitive
+1b7e4070f5f7b7522422f5b00a75b323cc314daf vim/bundle/fugitive
 91190e67720f852c17602504d5225d4e675b6499 vim/bundle/gundo
 ffc45dd5a59b7b62edb02641c69a163f19fd02c0 vim/bundle/hammer
 4ef2d418f48d30fed2f7ce00f598d6871a0010fe vim/bundle/html5
@@ -13,7 +14,7 @@
 2dd198c6c412b4ddd361b43586b01981e8383239 vim/bundle/nerdtree
 b7889db57c90824ff5092da4fdde9e05689f24fa vim/bundle/nosecompiler
 a0831b09f2026c3a3d52e253ffd139fe20a9360a vim/bundle/pydoc
-25de1e1969b6b5c92fec67adbd98da65533b545c vim/bundle/slimv
+e201d578c03156a3dd7176973f2187f4e957f466 vim/bundle/slimv
 c6197a10ace82e0fe0c08e5cf5c017b7069a978e vim/bundle/sparkup
 6eec2c131213850ed65fd6da494dfd1a0d620a4e vim/bundle/strftimedammit
 80ec6539e4139a2e0281a0f1e36d5038d55ad980 vim/bundle/supertab
@@ -25,5 +26,5 @@
 8d06adbd56a761684701d1c60990b72c845be3d5 vim/bundle/vim-commentary
 6362ba99c825afc046818807267d5c1143b5c887 vim/bundle/vim-javascript
 f21fbd8759d7fa6c3cb1bbb9fe05eae90422f01a vim/bundle/vim-makegreen
-d0daeb317df54c513278f20bda49be01384bdb7d vim/bundle/vim-orgmode
+54b7bfc8170f3fa1519e5559c37a4f3e31c032c9 vim/bundle/vim-orgmode
 b0ee6ec2153c5f30827d67db1668f37a975a1005 vim/bundle/vim-speeddating
--- a/.zshrc	Tue Oct 11 09:09:18 2011 -0400
+++ b/.zshrc	Wed Oct 19 14:35:48 2011 -0400
@@ -25,6 +25,7 @@
 export PATH="$HOME/.gem/ruby/1.8/bin:${PATH}"
 export PATH="/usr/local/bin:/usr/local/sbin:$HOME/bin:/opt/local/bin:$PATH"
 export PATH="/opt/subversion/bin:${PATH}"
+export PATH="/usr/local/Cellar/ruby/1.9.2-p290/bin:${PATH}"
 export GREP_OPTIONS='--color=auto'
 export HISTSIZE=1000
 export HISTFILESIZE=1000
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dotcss/github.com.css	Wed Oct 19 14:35:48 2011 -0400
@@ -0,0 +1,2 @@
+.native-clones { display: none; }
+.tree-browser td.content { font-family: Menlo; font-size: 12px; }
--- a/vim/.vimrc	Tue Oct 11 09:09:18 2011 -0400
+++ b/vim/.vimrc	Wed Oct 19 14:35:48 2011 -0400
@@ -47,6 +47,7 @@
 set autowrite
 set shiftround
 set autoread
+set title
 set dictionary=/usr/share/dict/words
 
 " Wildmenu completion {{{
@@ -354,7 +355,7 @@
     au BufNewFile,BufRead Slimv.REPL.clj setlocal nowrap
     au BufNewFile,BufRead Slimv.REPL.clj setlocal foldlevel=99
     au BufNewFile,BufRead Slimv.REPL.clj nnoremap <buffer> A GA
-    au BufNewFile,BufRead Slimv.REPL.clj unmap <buffer> \\\
+    au BufNewFile,BufRead Slimv.REPL.clj nnoremap <buffer> <localleader>R :emenu REPL.<Tab>
 
     " Fix the eval mapping.
     au FileType clojure nmap <buffer> \ee \ed
@@ -545,6 +546,8 @@
     au BufRead,BufNewFile /etc/nginx/sites-available/*           set ft=nginx
     au BufRead,BufNewFile /usr/local/etc/nginx/sites-available/* set ft=nginx
     au BufRead,BufNewFile vhost.nginx                            set ft=nginx
+
+    au FileType nginx setlocal foldmethod=marker foldmarker={,}
 augroup END
 
 " }}}
@@ -652,6 +655,26 @@
 nnoremap <leader>ek <C-w>s<C-w>j<C-w>L:e ~/lib/dotfiles/keymando/keymandorc.rb<cr>
 
 " }}}
+" Shell ----------------------------------------------------------------------- {{{
+
+function! s:ExecuteInShell(command) " {{{
+    let command = join(map(split(a:command), 'expand(v:val)'))
+    let winnr = bufwinnr('^' . command . '$')
+    silent! execute  winnr < 0 ? 'botright vnew ' . fnameescape(command) : winnr . 'wincmd w'
+    setlocal buftype=nowrite bufhidden=wipe nobuflisted noswapfile nowrap nonumber
+    echo 'Execute ' . command . '...'
+    silent! execute 'silent %!'. command
+    silent! redraw
+    silent! execute 'au BufUnload <buffer> execute bufwinnr(' . bufnr('#') . ') . ''wincmd w'''
+    silent! execute 'nnoremap <silent> <buffer> <LocalLeader>r :call <SID>ExecuteInShell(''' . command . ''')<CR>:AnsiEsc<CR>'
+    silent! execute 'nnoremap <silent> <buffer> q :q<CR>'
+    silent! execute 'AnsiEsc'
+    echo 'Shell command ' . command . ' executed.'
+endfunction " }}}
+command! -complete=shellcmd -nargs=+ Shell call s:ExecuteInShell(<q-args>)
+nnoremap <leader>! :Shell 
+
+" }}}
 " Convenience mappings -------------------------------------------------------- {{{
 
 " Clean whitespace
@@ -693,6 +716,9 @@
 vnoremap <leader>Ac :center<cr>
 vnoremap <leader>Ar :right<cr>
 
+" Less chording
+nnoremap ; :
+
 " Faster Esc
 inoremap jk <esc>
 
@@ -722,6 +748,7 @@
 
 " I suck at typing.
 nnoremap <localleader>= ==
+vnoremap - =
 
 " Easy filetype switching {{{
 nnoremap _md :set ft=markdown<CR>
@@ -776,6 +803,7 @@
 inoremap <s-cr> <esc>A:<cr>
 
 " Indent Guides {{{
+
 let g:indentguides_state = 0
 function! IndentGuides() " {{{
     if g:indentguides_state
@@ -789,6 +817,27 @@
 nnoremap <leader>i :call IndentGuides()<cr>
 
 " }}}
+" Block Colors {{{
+
+let g:blockcolor_state = 0
+function! BlockColor() " {{{
+    if g:blockcolor_state
+        let g:blockcolor_state = 0
+        call matchdelete(77880)
+        call matchdelete(77881)
+        call matchdelete(77882)
+        call matchdelete(77883)
+    else
+        let g:blockcolor_state = 1
+        call matchadd("BlockColor1", '^ \{4}.*', 1, 77880)
+        call matchadd("BlockColor2", '^ \{8}.*', 2, 77881)
+        call matchadd("BlockColor3", '^ \{12}.*', 3, 77882)
+        call matchadd("BlockColor4", '^ \{16}.*', 4, 77883)
+    endif
+endfunction " }}}
+nnoremap <leader>B :call BlockColor()<cr>
+
+" }}}
 " Insert Mode Completion {{{
 
 inoremap <c-l> <c-x><c-l>
@@ -848,6 +897,7 @@
 nnoremap <leader>gci :Gcommit<cr>
 nnoremap <leader>gm :Gmove<cr>
 nnoremap <leader>gr :Gremove<cr>
+nnoremap <leader>gl :Shell git gl -18<cr>:wincmd \|<cr>
 
 augroup ft_fugitive
     au!
--- a/vim/colors/molokai.vim	Tue Oct 11 09:09:18 2011 -0400
+++ b/vim/colors/molokai.vim	Wed Oct 19 14:35:48 2011 -0400
@@ -51,6 +51,12 @@
 hi iCursor         guifg=#000000 guibg=#FDFF00
 hi vCursor         guifg=#000000 guibg=#AAF412
 " }}}
+" Block Colors {{{
+hi BlockColor1 guibg=#2a2a2a
+hi BlockColor2 guibg=#333333
+hi BlockColor3 guibg=#3b3b3b
+hi BlockColor4 guibg=#424242
+" }}}
 
 hi GreenBar term=reverse ctermfg=white ctermbg=green guifg=black guibg=#9edf1c
 hi RedBar   term=reverse ctermfg=white ctermbg=red guifg=white guibg=#C50048
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/weechat/python/autoload/colon_complete.py	Wed Oct 19 14:35:48 2011 -0400
@@ -0,0 +1,55 @@
+SCRIPT_NAME='coloncomplete'
+SCRIPT_AUTHOR='Steve Losh <steve@stevelosh.com>'
+SCRIPT_VERSION='1.0'
+SCRIPT_LICENSE='MIT/X11'
+SCRIPT_DESC='Add a colon after nick completion when all the previous words in the input are also nicks.'
+
+import_ok=True
+
+try:
+    import weechat
+except ImportError:
+    print 'This script must be run under WeeChat'
+    print 'You can obtain a copy of WeeChat, for free, at http://www.weechat.org'
+    import_ok=False
+
+weechat_version=0
+
+def get_nicks(buffer, prefix=''):
+    channel = weechat.buffer_get_string(buffer, 'localvar_channel')
+    server = weechat.buffer_get_string(buffer, 'localvar_server')
+
+    matches = []
+
+    infolist = weechat.infolist_get('irc_nick', '', '%s,%s' % (server, channel))
+    while weechat.infolist_next(infolist):
+        nick = weechat.infolist_string(infolist, 'name')
+        if nick != 'localhost' and nick.lower().startswith(prefix.lower()):
+            matches.append(nick)
+    weechat.infolist_free(infolist)
+
+    return matches
+
+def completer(data, buffer, command):
+    cb = weechat.current_buffer()
+    if command == "/input complete_next":
+        line = weechat.buffer_get_string(cb, "input")
+        words = line.split(' ')
+        prefix = words[-1]
+        if prefix and words and all([s.endswith(':') for s in words[:-1] if s]):
+            nicks = get_nicks(cb, prefix)
+            if len(nicks) == 1:
+                for _ in range(len(prefix)):
+                    weechat.command(buffer, "/input delete_previous_char")
+                weechat.command(buffer, "/input insert " + nicks[-1] + ":\\x20")
+            elif len(nicks) > 1:
+                for nick in nicks:
+                    weechat.prnt(cb, "==> " + nick)
+                return weechat.WEECHAT_RC_OK_EAT
+
+    return weechat.WEECHAT_RC_OK
+
+if __name__ == "__main__" and import_ok:
+    if weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, SCRIPT_LICENSE, SCRIPT_DESC, "", ""):
+        weechat_version = weechat.info_get("version_number", "") or 0
+        weechat.hook_command_run('/input complete*', 'completer', '')
--- a/weechat/python/autoload/growl.py	Tue Oct 11 09:09:18 2011 -0400
+++ b/weechat/python/autoload/growl.py	Wed Oct 19 14:35:48 2011 -0400
@@ -1,136 +1,146 @@
 # -*- coding: utf-8 -*-
 #
-# growl.py 
+# growl.py
 # Copyright (c) 2011 Sorin Ionescu <sorin.ionescu@gmail.com>
 #
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
 
 
-SCRIPT_NAME    = 'growl'
-SCRIPT_AUTHOR  = 'Sorin Ionescu <sorin.ionescu@gmail.com>'
-SCRIPT_VERSION = '1.0.0'
-SCRIPT_LICENSE = 'GPL3'
-SCRIPT_DESC    = 'Sends Growl notifications upon events.'
+SCRIPT_NAME = 'growl'
+SCRIPT_AUTHOR = 'Sorin Ionescu <sorin.ionescu@gmail.com>'
+SCRIPT_VERSION = '1.0.4'
+SCRIPT_LICENSE = 'MIT'
+SCRIPT_DESC = 'Sends Growl notifications upon events.'
+
 
 # Changelog
-#
+# 2011-10-11: v1.0.4 Handle import errors better.
+# 2011-10-10: v1.0.3 Handle Growl exceptions.
+# 2011-10-04: v1.0.2 Growl 1.3 requires GNTP.
+# 2011-09-25: v1.0.1 Always show highlighted messages if set on.
 # 2011-03-27: v1.0.0 Initial release.
 
 
-# ------------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
 # Settings
-# ------------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
 SETTINGS = {
-    'show_public_message'         : 'off',
-    'show_private_message'        : 'on',
-    'show_public_action_message'  : 'off',
-    'show_private_action_message' : 'on',
-    'show_notice_message'         : 'off',
-    'show_invite_message'         : 'on',
-    'show_highlighted_message'    : 'on',
-    'show_server'                 : 'on',
-    'show_channel_topic'          : 'on',
-    'show_dcc'                    : 'on',
-    'show_upgrade_ended'          : 'on',
-    'sticky'                      : 'off',
-    'sticky_away'                 : 'on',
-    'hostname'                    : '',
-    'password'                    : '',
-    'icon'                        : 'icon.png',
+    'show_public_message': 'off',
+    'show_private_message': 'on',
+    'show_public_action_message': 'off',
+    'show_private_action_message': 'on',
+    'show_notice_message': 'off',
+    'show_invite_message': 'on',
+    'show_highlighted_message': 'on',
+    'show_server': 'on',
+    'show_channel_topic': 'on',
+    'show_dcc': 'on',
+    'show_upgrade_ended': 'on',
+    'sticky': 'off',
+    'sticky_away': 'on',
+    'hostname': '',
+    'password': '',
+    'icon': 'icon.png',
 }
 
 
-# ------------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
 # Imports
-# ------------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
 try:
     import re
     import os
     import weechat
-    import Growl
+    from gntp.notifier import GrowlNotifier
     IMPORT_OK = True
 except ImportError as error:
     IMPORT_OK = False
-    if str(error) == 'No module named weechat':
+    if str(error).find('weechat') != -1:
         print('This script must be run under WeeChat.')
         print('Get WeeChat at http://www.weechat.org.')
-    if str(error) == 'No module named Growl':
-        weechat.prnt('', 'Growl: Python bindings are not installed.')
-
+    elif str(error).find('notifier') != -1:
+        weechat.prnt('', 'growl: GNTP bindings are not installed')
+    else:
+        weechat.prnt('', 'growl: {0}'.format(error))
 
-# ------------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
 # Globals
-# ------------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
 TAGGED_MESSAGES = {
-    'public message or action'  : set(['irc_privmsg', 'notify_message']),
-    'private message or action' : set(['irc_privmsg', 'notify_private']),
-    'notice message'            : set(['irc_notice', 'notify_private']),
-    'invite message'            : set(['irc_invite', 'notify_highlight']),
-    'channel topic'             : set(['irc_topic',]),
-    'away status'               : set(['away_info',]),
+    'public message or action': set(['irc_privmsg', 'notify_message']),
+    'private message or action': set(['irc_privmsg', 'notify_private']),
+    'notice message': set(['irc_notice', 'notify_private']),
+    'invite message': set(['irc_invite', 'notify_highlight']),
+    'channel topic': set(['irc_topic', ]),
+    'away status': set(['away_info', ]),
 }
 
+
 UNTAGGED_MESSAGES = {
-    'dcc chat request'   : re.compile(
-                               r'^xfer: incoming chat request from (\w+)',
-                               re.UNICODE),
-    'dcc chat closed'    : re.compile(
-                               r'^xfer: chat closed with (\w+)',
-                               re.UNICODE),
-    'dcc get request'    : re.compile(
-                               r'^xfer: incoming file from (\w+) [^:]+: ' +
-                                   '((?:,\w|[^,])+),',
-                               re.UNICODE),
-    'dcc get completed'  : re.compile(
-                               r'^xfer: file ([^\s]+) received from \w+: OK',
-                               re.UNICODE),
-    'dcc get failed'     : re.compile(
-                               r'^xfer: file ([^\s]+) received from \w+: ' +
-                                   'FAILED',
-                               re.UNICODE),
-    'dcc send completed' : re.compile(
-                               r'^xfer: file ([^\s]+) sent to \w+: OK',
-                               re.UNICODE),
-    'dcc send failed'    : re.compile(
-                               r'^xfer: file ([^\s]+) sent to \w+: FAILED',
-                               re.UNICODE),
+    'dcc chat request':
+        re.compile(r'^xfer: incoming chat request from (\w+)', re.UNICODE),
+    'dcc chat closed':
+        re.compile(r'^xfer: chat closed with (\w+)', re.UNICODE),
+    'dcc get request':
+        re.compile(
+            r'^xfer: incoming file from (\w+) [^:]+: ((?:,\w|[^,])+),',
+            re.UNICODE),
+    'dcc get completed':
+        re.compile(r'^xfer: file ([^\s]+) received from \w+: OK', re.UNICODE),
+    'dcc get failed':
+        re.compile(
+            r'^xfer: file ([^\s]+) received from \w+: FAILED',
+            re.UNICODE),
+    'dcc send completed':
+        re.compile(r'^xfer: file ([^\s]+) sent to \w+: OK', re.UNICODE),
+    'dcc send failed':
+        re.compile(r'^xfer: file ([^\s]+) sent to \w+: FAILED', re.UNICODE),
 }
 
+
 DISPATCH_TABLE = {
-    'away status'               : 'set_away_status',
-    'public message or action'  : 'notify_public_message_or_action',
-    'private message or action' : 'notify_private_message_or_action',
-    'notice message'            : 'notify_notice_message',
-    'invite message'            : 'notify_invite_message',
-    'channel topic'             : 'notify_channel_topic',
-    'dcc chat request'          : 'notify_dcc_chat_request',
-    'dcc chat closed'           : 'notify_dcc_chat_closed',
-    'dcc get request'           : 'notify_dcc_get_request',
-    'dcc get completed'         : 'notify_dcc_get_completed',
-    'dcc get failed'            : 'notify_dcc_get_failed',
-    'dcc send completed'        : 'notify_dcc_send_completed',
-    'dcc send failed'           : 'notify_dcc_send_failed',
+    'away status': 'set_away_status',
+    'public message or action': 'notify_public_message_or_action',
+    'private message or action': 'notify_private_message_or_action',
+    'notice message': 'notify_notice_message',
+    'invite message': 'notify_invite_message',
+    'channel topic': 'notify_channel_topic',
+    'dcc chat request': 'notify_dcc_chat_request',
+    'dcc chat closed': 'notify_dcc_chat_closed',
+    'dcc get request': 'notify_dcc_get_request',
+    'dcc get completed': 'notify_dcc_get_completed',
+    'dcc get failed': 'notify_dcc_get_failed',
+    'dcc send completed': 'notify_dcc_send_completed',
+    'dcc send failed': 'notify_dcc_send_failed',
 }
 
+
 STATE = {
-    'growl'   : None,
-    'is_away' : False
+    'growl': None,
+    'icon': None,
+    'is_away': False
 }
 
-# ------------------------------------------------------------------------------
-# Notifiers 
-# ------------------------------------------------------------------------------
+
+# -----------------------------------------------------------------------------
+# Notifiers
+# -----------------------------------------------------------------------------
 def cb_irc_server_connected(data, signal, signal_data):
     '''Notify when connected to IRC server.'''
     if weechat.config_get_plugin('show_server') == 'on':
@@ -140,6 +150,7 @@
             'Connected to network {0}.'.format(signal_data))
     return weechat.WEECHAT_RC_OK
 
+
 def cb_irc_server_disconnected(data, signal, signal_data):
     '''Notify when disconnected to IRC server.'''
     if weechat.config_get_plugin('show_server') == 'on':
@@ -149,6 +160,7 @@
             'Disconnected from network {0}.'.format(signal_data))
     return weechat.WEECHAT_RC_OK
 
+
 def cb_notify_upgrade_ended(data, signal, signal_data):
     '''Notify on end of WeeChat upgrade.'''
     if weechat.config_get_plugin('show_upgrade_ended') == 'on':
@@ -158,6 +170,7 @@
             'WeeChat has been upgraded.')
     return weechat.WEECHAT_RC_OK
 
+
 def notify_highlighted_message(prefix, message):
     '''Notify on highlighted message.'''
     if weechat.config_get_plugin("show_highlighted_message") == "on":
@@ -167,6 +180,7 @@
             "{0}: {1}".format(prefix, message),
             priority=2)
 
+
 def notify_public_message_or_action(prefix, message, highlighted):
     '''Notify on public message or action.'''
     if prefix == ' *':
@@ -179,12 +193,12 @@
     else:
         if highlighted:
             notify_highlighted_message(prefix, message)
-        else:
-            if weechat.config_get_plugin("show_public_message") == "on":
-                growl_notify(
-                    'Public',
-                    'Public Message',
-                    '{0}: {1}'.format(prefix, message))
+        elif weechat.config_get_plugin("show_public_message") == "on":
+            growl_notify(
+                'Public',
+                'Public Message',
+                '{0}: {1}'.format(prefix, message))
+
 
 def notify_private_message_or_action(prefix, message, highlighted):
     '''Notify on private message or action.'''
@@ -203,52 +217,52 @@
         else:
             if highlighted:
                 notify_highlighted_message(prefix, message)
-            else:
-                if weechat.config_get_plugin("show_private_message") == "on":
-                    growl_notify(
-                        'Private',
-                        'Private Message',
-                        '{0}: {1}'.format(prefix, message))
+            elif weechat.config_get_plugin("show_private_message") == "on":
+                growl_notify(
+                    'Private',
+                    'Private Message',
+                    '{0}: {1}'.format(prefix, message))
+
 
 def notify_public_action_message(prefix, message, highlighted):
     '''Notify on public action message.'''
-    if weechat.config_get_plugin("show_public_action_message") == "on":
-        if highlighted:
-            notify_highlighted_message(prefix, message)
-        else:
-            growl_notify(
-                'Action',
-                'Public Action Message',
-                '{0}: {1}'.format(prefix, message),
-                priority=1)
+    if highlighted:
+        notify_highlighted_message(prefix, message)
+    elif weechat.config_get_plugin("show_public_action_message") == "on":
+        growl_notify(
+            'Action',
+            'Public Action Message',
+            '{0}: {1}'.format(prefix, message),
+            priority=1)
+
 
 def notify_private_action_message(prefix, message, highlighted):
     '''Notify on private action message.'''
-    if weechat.config_get_plugin("show_private_action_message") == "on":
-        if highlighted:
-            notify_highlighted_message(prefix, message)
-        else:
-            growl_notify(
-                'Action',
-                'Private Action Message',
-                '{0}: {1}'.format(prefix, message),
-                priority=1)
+    if highlighted:
+        notify_highlighted_message(prefix, message)
+    elif weechat.config_get_plugin("show_private_action_message") == "on":
+        growl_notify(
+            'Action',
+            'Private Action Message',
+            '{0}: {1}'.format(prefix, message),
+            priority=1)
+
 
 def notify_notice_message(prefix, message, highlighted):
     '''Notify on notice message.'''
-    if weechat.config_get_plugin("show_notice_message") == "on":
-        regex = re.compile(r'^([^\s]*) [^:]*: (.+)$', re.UNICODE)
-        match = regex.match(message)
-        if match:
-            prefix = match.group(1)
-            message = match.group(2)
-            if highlighted:
-                notify_highlighted_message(prefix, message)
-            else:
-                growl_notify(
-                    'Notice',
-                    'Notice Message',
-                    '{0}: {1}'.format(prefix, message))
+    regex = re.compile(r'^([^\s]*) [^:]*: (.+)$', re.UNICODE)
+    match = regex.match(message)
+    if match:
+        prefix = match.group(1)
+        message = match.group(2)
+        if highlighted:
+            notify_highlighted_message(prefix, message)
+        elif weechat.config_get_plugin("show_notice_message") == "on":
+            growl_notify(
+                'Notice',
+                'Notice Message',
+                '{0}: {1}'.format(prefix, message))
+
 
 def notify_invite_message(prefix, message, highlighted):
     '''Notify on channel invitation message.'''
@@ -264,11 +278,12 @@
                 'Channel Invitation',
                 '{0} has invited you to join {1}.'.format(nick, channel))
 
+
 def notify_channel_topic(prefix, message, highlighted):
     '''Notify on channel topic change.'''
     if weechat.config_get_plugin("show_channel_topic") == "on":
         regex = re.compile(
-            r'^\w+ has (?:changed|unset) topic for ([^\s]+)'+
+            r'^\w+ has (?:changed|unset) topic for ([^\s]+)' +
                 '(?:(?: from "(?:(?:"\w|[^"])+)")? to "((?:"\w|[^"])+)")?',
             re.UNICODE)
         match = regex.match(message)
@@ -280,6 +295,7 @@
                 'Channel Topic',
                 "{0}: {1}".format(channel, topic))
 
+
 def notify_dcc_chat_request(match):
     '''Notify on DCC chat request.'''
     if weechat.config_get_plugin("show_dcc") == "on":
@@ -289,6 +305,7 @@
             'Direct Chat Request',
             '{0} wants to chat directly.'.format(nick))
 
+
 def notify_dcc_chat_closed(match):
     '''Notify on DCC chat termination.'''
     if weechat.config_get_plugin("show_dcc") == "on":
@@ -298,6 +315,7 @@
             'Direct Chat Ended',
             'Direct chat with {0} has ended.'.format(nick))
 
+
 def notify_dcc_get_request(match):
     'Notify on DCC get request.'
     if weechat.config_get_plugin("show_dcc") == "on":
@@ -308,24 +326,28 @@
             'File Transfer Request',
             '{0} wants to send you {1}.'.format(nick, file_name))
 
+
 def notify_dcc_get_completed(match):
     'Notify on DCC get completion.'
     if weechat.config_get_plugin("show_dcc") == "on":
         file_name = match.group(1)
         growl_notify('DCC', 'Download Complete', file_name)
 
+
 def notify_dcc_get_failed(match):
     'Notify on DCC get failure.'
     if weechat.config_get_plugin("show_dcc") == "on":
         file_name = match.group(1)
         growl_notify('DCC', 'Download Failed', file_name)
 
+
 def notify_dcc_send_completed(match):
     'Notify on DCC send completion.'
     if weechat.config_get_plugin("show_dcc") == "on":
         file_name = match.group(1)
         growl_notify('DCC', 'Upload Complete', file_name)
 
+
 def notify_dcc_send_failed(match):
     'Notify on DCC send failure.'
     if weechat.config_get_plugin("show_dcc") == "on":
@@ -333,9 +355,9 @@
         growl_notify('DCC', 'Upload Failed', file_name)
 
 
-# ------------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
 # Utility
-# ------------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
 def set_away_status(prefix, message, highlighted):
     '''Sets away status for use by sticky notifications.'''
     regex = re.compile(r'^\[\w+ \b(away|back)\b:', re.UNICODE)
@@ -347,6 +369,7 @@
         if status == 'back':
             STATE['is_away'] = False
 
+
 def cb_process_message(
     data,
     wbuffer,
@@ -385,21 +408,32 @@
             return weechat.WEECHAT_RC_OK
     return weechat.WEECHAT_RC_OK
 
+
 def growl_notify(notification, title, description, priority=None):
     '''Returns whether Growl notifications should be sticky.'''
     growl = STATE['growl']
     is_away = STATE['is_away']
+    icon = STATE['icon']
     is_sticky = False
     if weechat.config_get_plugin('sticky') == 'on':
         is_sticky = True
     if weechat.config_get_plugin('sticky_away') == 'on' and is_away:
         is_sticky = True
-    growl.notify(notification, title, description, '', is_sticky, priority)
+    try:
+        growl.notify(
+            noteType=notification,
+            title=title,
+            description=description,
+            icon=icon,
+            sticky=is_sticky,
+            priority=priority)
+    except Exception as error:
+        weechat.prnt('', 'growl: {0}'.format(error))
 
 
-# ------------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
 # Main
-# ------------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
 def main():
     '''Sets up WeeChat Growl notifications.'''
     # Initialize options.
@@ -410,7 +444,7 @@
     name = "WeeChat"
     hostname = weechat.config_get_plugin('hostname')
     password = weechat.config_get_plugin('password')
-    icon = Growl.Image.imageFromPath(
+    icon = 'file://{0}'.format(
         os.path.join(
             weechat.info_get("weechat_dir", ""),
             weechat.config_get_plugin('icon')))
@@ -430,14 +464,18 @@
         hostname = None
     if len(password) == 0:
         password = None
-    growl = Growl.GrowlNotifier(
+    growl = GrowlNotifier(
         applicationName=name,
         hostname=hostname,
         password=password,
         notifications=notifications,
         applicationIcon=icon)
-    growl.register()
+    try:
+        growl.register()
+    except Exception as error:
+        weechat.prnt('', 'growl: {0}'.format(error))
     STATE['growl'] = growl
+    STATE['icon'] = icon
     # Register hooks.
     weechat.hook_signal(
         'irc_server_connected',
@@ -450,6 +488,7 @@
     weechat.hook_signal('upgrade_ended', 'cb_upgrade_ended', '')
     weechat.hook_print('', '', '', 1, 'cb_process_message', '')
 
+
 if __name__ == '__main__' and IMPORT_OK and weechat.register(
     SCRIPT_NAME,
     SCRIPT_AUTHOR,
@@ -460,4 +499,3 @@
     ''
 ):
     main()
-
--- a/weechat/weechat.conf	Tue Oct 11 09:09:18 2011 -0400
+++ b/weechat/weechat.conf	Wed Oct 19 14:35:48 2011 -0400
@@ -82,7 +82,7 @@
 chat_highlight_bg = default
 chat_host = cyan
 chat_nick = lightcyan
-chat_nick_colors = "226,202,206,081,082,099,068"
+chat_nick_colors = "226,208,136,206,081,082,099,068,048,112"
 chat_nick_other = cyan
 chat_nick_self = white
 chat_prefix_action = white