Merge remote-tracking branch 'origin/master' into phoenix

Conflicts:
	.config/cower/config
	.emacs.d/init.el
This commit is contained in:
Tom Willemsen 2012-10-12 08:52:53 +02:00
commit 77c39ea0f0
33 changed files with 2908 additions and 719 deletions

View file

@ -16,27 +16,28 @@ urxvt.perl-ext-common: default,matcher,searchable-scrollback
urxvt.urlLauncher: conkeror urxvt.urlLauncher: conkeror
urxvt.matcher.button: 1 urxvt.matcher.button: 1
urxvt.font: xft:Monaco:weight=medium:pixelsize=18 urxvt.font: xft:Press Start 2P-10
urxvt.boldFont: xft:Monaco:weight=black:pixelsize=18 ! xft:Monaco:weight=medium:pixelsize=18
urxvt.italicFont: xft:Monaco:slant=italic:pixelsize=18 ! urxvt.boldFont: xft:Monaco:weight=black:pixelsize=18
! urxvt.italicFont: xft:Monaco:slant=italic:pixelsize=18
urxvt.background: #252a2b urxvt.background: #111113
urxvt.foreground: #eeeeec urxvt.foreground: #eeeeec
urxvt.color0: #0c191c urxvt.color0: #171719
urxvt.color8: #2e3436 urxvt.color8: #222224
urxvt.color1: #a40000 urxvt.color1: #8b1a1a
urxvt.color9: #ef2929 urxvt.color9: #ff5d55
urxvt.color2: #4e9a06 urxvt.color2: #4e9a06
urxvt.color10: #8ae234 urxvt.color10: #9ad870
urxvt.color3: #c4a000 urxvt.color3: #c4a000
urxvt.color11: #fce94f urxvt.color11: #cfce29
urxvt.color4: #204a87 urxvt.color4: #2729b6
urxvt.color12: #729fcf urxvt.color12: #78a2c1
urxvt.color5: #5c3566 urxvt.color5: #5c3566
urxvt.color13: #ad7fa8 urxvt.color13: #ad7fa8
@ -44,8 +45,8 @@ urxvt.color13: #ad7fa8
urxvt.color6: #9f5902 urxvt.color6: #9f5902
urxvt.color14: #e9b96e urxvt.color14: #e9b96e
urxvt.color7: #babdb6 urxvt.color7: #999999
urxvt.color15: #d3d7cf urxvt.color15: #a9a9a9
Xft.antialias: true Xft.antialias: true
Xft.rgba: rgb Xft.rgba: rgb

5
.Xmodmap Normal file
View file

@ -0,0 +1,5 @@
pointer = 3 2 1
remove Mod5 = ISO_Level3_Shift
keycode 108 = Alt_L
add Mod1 = Alt_L

1
.bash_profile Symbolic link
View file

@ -0,0 +1 @@
.zprofile

14
.beetsconfig Normal file
View file

@ -0,0 +1,14 @@
[beets]
library: ~/.local/share/beets/library.blb
directory: /mnt/music/lib/
plugins: mpdupdate embedart
[paths]
default: $albumartist/$year - $album/$track - $title
singleton: Non-Album/$artist - $title
comp: Compilations/$year - $album/$track - $artist - $title
[mpdupdate]
host: localhost
port: 6600

View file

@ -65,3 +65,17 @@ function run_or_raise(cmd, properties)
end end
awful.util.spawn(cmd) awful.util.spawn(cmd)
end end
function prev_client()
awful.client.focus.history.previous()
if client.focus then
client.focus:raise()
end
end
function next_client()
awful.client.focus.byidx(1)
if client.focus then
client.focus:raise()
end
end

View file

@ -202,13 +202,11 @@ local bind = keychain
local sub = keychain.sub local sub = keychain.sub
globalkeys = awful.util.table.join( globalkeys = awful.util.table.join(
bind({ "Control", }, "i", bind({ "Control", }, "i",
{ sub({ }, "o", { sub({ }, "space", ext.next_client),
function () sub({ }, ",",
awful.client.focus.byidx(1)
if client.focus then client.focus:raise() end
end),
sub({ "Shift", }, "o",
function () awful.screen.focus_relative(1) end), function () awful.screen.focus_relative(1) end),
sub({ }, ".",
function () awful.screen.focus_relative(-1) end),
sub({ "Shift", }, "1", sub({ "Shift", }, "1",
function () mypromptbox[mouse.screen]:run() end), function () mypromptbox[mouse.screen]:run() end),
sub({ }, "f", function () oni.focus_raise("right") end), sub({ }, "f", function () oni.focus_raise("right") end),
@ -220,7 +218,8 @@ globalkeys = awful.util.table.join(
sub({ }, "e", oni.ror_editor), sub({ }, "e", oni.ror_editor),
sub({ "Shift", }, "e", oni.run_editor), sub({ "Shift", }, "e", oni.run_editor),
sub({ }, "w", oni.ror_browser), sub({ }, "w", oni.ror_browser),
sub({ "Shift", }, "w", oni.run_browser) }), sub({ "Shift", }, "w", oni.run_browser),
sub({ "Control", }, "i", ext.prev_client) }),
awful.key({ "Control", "Mod1" }, "l", awful.key({ "Control", "Mod1" }, "l",
function () awful.util.spawn("i3lock -c 000000") end), function () awful.util.spawn("i3lock -c 000000") end),
awful.key({ modkey, }, "Left", awful.tag.viewprev ), awful.key({ modkey, }, "Left", awful.tag.viewprev ),
@ -233,13 +232,6 @@ globalkeys = awful.util.table.join(
awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end), awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end),
awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end), awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end),
awful.key({ modkey, }, "u", awful.client.urgent.jumpto), awful.key({ modkey, }, "u", awful.client.urgent.jumpto),
awful.key({ modkey, }, "Tab",
function ()
awful.client.focus.history.previous()
if client.focus then
client.focus:raise()
end
end),
-- Standard program -- Standard program
awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end), awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end),

25
.config/clfswm/clfswmrc Normal file
View file

@ -0,0 +1,25 @@
;; -*- mode: lisp; -*-
(in-package :clfswm)
(defun start-i3lock ()
"Run i3lock"
(do-shell "exec i3lock -c 000000"))
(defun start-i3lock-2 ()
"Run i3lock in second mode"
(setf *second-mode-leave-function* 'start-i3lock)
(leave-second-mode))
(defun my-bindings ()
(define-main-key ("l" :mod-1 :control) 'start-i3lock)
(define-second-key ("l" :mod-1 :control) 'start-i3lock-2))
(add-hook *binding-hook* 'my-bindings)
;; (defun my-init-hook ()
;; (add-frame (create-frame :name "The Gimp" :x 0.6 :y 0 :w 0.3 :h 0.2) *root-frame*))
;;y (add-hook *init-hook* 'my-init-hook)
;;(setf *frame-background* "#252a2b")
;;(setf *frame-foreground* "#eeeeec")

3
.config/cower/config Normal file
View file

@ -0,0 +1,3 @@
Color = always
TargetDir = /home/slash/var/aur/
IgnoreRepo = pegas

76
.config/fish/config.fish Normal file
View file

@ -0,0 +1,76 @@
function fish_prompt -d "Write out the prompt"
set last_status $status
set current_directory (prompt_pwd)
set git_branch (git branch --contains HEAD 2>/dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
set cnormal (set_color white)
echo -n $cnormal
printf '%s%s%s' (set_color magenta) (hostname|cut -d . -f 1) $cnormal
if test -n "$current_directory"
printf ' %s%s%s' (set_color $fish_color_cwd) $current_directory $cnormal
end
if test -n "$git_branch"
printf '@%s%s%s' (set_color yellow) $git_branch $cnormal
end
if test $last_status -eq 0
printf '%s' (set_color --bold green)
else
printf '%s' (set_color --bold red)
end
printf '>%s ' (set_color normal)
end
function grep
/bin/grep --color=always $argv
end
function less
/bin/less -FXRS $argv
end
function ls
/bin/ls -F --color=always $argv
end
function mysql
/usr/bin/mysql --pager $argv
end
function slrn
set -x NNTPSERVER 'news.gmane.org'
/usr/bin/slrn $argv
end
function shutdown
dbus-send --system --print-reply \
--dest="org.freedesktop.ConsoleKit" \
/org/freedesktop/ConsoleKit/Manager \
org.freedesktop.ConsoleKit.Manager.Stop
end
function reboot
dbus-send --system --print-reply \
--dest="org.freedesktop.ConsoleKit" \
/org/freedesktop/ConsoleKit/Manager \
org.freedesktop.ConsoleKit.Manager.Restart
end
function engage
play -n -c1 synth whitenoise band -n 100 20 band -n 50 20 gain +25 fade h 1 864000 1
end
function lscompmod -d "List kernel modules used by hardware"
lspci -mvk | awk '/^Module/ {print $2}' | sort -u
end
set -x PAGER 'less -FXRS'
set -x BROWSER conkeror
set -x EDITOR 'emacsclient -c -a emacs'
set -x PATH ~/usr/bin $PATH /sbin /usr/sbin /usr/local/emacs/bin/ \
/usr/local/bin /usr/local/stumpwm/bin /usr/local/scwm/bin \
/usr/local/clfswm/bin /opt/plan9/bin

46
.config/herbstluftwm/autostart Executable file
View file

@ -0,0 +1,46 @@
#!/bin/zsh
function hc () {
herbstclient $@
}
modkey="Mod4"
hc keybind $modkey+Ctrl+q quit
hc keybind $modkey+e spawn emacs
hc set frame_bg_normal_color "#0c191c"
hc set frame_bg_active_color "#000000"
hc set frame_border_width 0
hc set window_border_width 1
hc set window_border_normal_color "#15abc3"
hc set window_border_active_color "#e0c625"
hc set focus_stealing_prevention 0
hc set default_frame_layout 2
hc set_layout max
hc add default2
hc remove_monitor 1
hc move_monitor 0 1920x1080+0+0
hc add_monitor 1680x1050+1920+0 default2
hc pad 0 -5 -5 -5 -5
hc pad 1 -5 -5 -5 -5
hc mousebind $modkey-Button1 move
hc mousebind $modkey-Button2 resize
hc mousebind $modkey-Button3 zoom
hc unrule -F
hc rule focus=on
hc rule windowtype=_NET_WM_WINDOW_TYPE_DIALOG focus=on pseudotile=on
hc rule class=Xephyr pseudotile=on
hc rule instance=Xine\ Window pseudotile=on
# xbindkeys
# ~/.config/herbstluftwm/panel.sh &
# hc load default "(split horizontal:0.550000:0 (split vertical:0.850000:0 (split horizontal:0.180000:1 (clients max:0) (clients max:0 0x140001a)) (clients max:0)) (clients max:0 0xc00077))"

150
.config/herbstluftwm/panel.sh Executable file
View file

@ -0,0 +1,150 @@
#!/bin/bash
monitor=${1:-0}
monitor2=1
geometry=( $(herbstclient monitor_rect "$monitor") )
if [ -z "$geometry" ] ;then
echo "Invalid monitor $monitor"
exit 1
fi
# geometry has the format: WxH+X+Y
x=${geometry[0]}
width=${geometry[2]}
height=12
y=0 #$(expr ${geometry[3]} - $height)
tag_width=40
font="-misc-tamsyn-medium-r-normal-*-14-*-*-*-*-*-iso8859-*"
selcolor='#24c6e0'
locolor='#657b83'
bgcolor='#002b36'
hicolor="#808080"
urcolor="#e0c625"
function uniq_linebuffered() {
awk '$0 != l { print ; l=$0 ; fflush(); }' "$@"
}
function print_tags() {
# draw tags
echo -n "$separator"
for i in "${TAGS[@]}" ; do
if [[ "${TAGS2[@]}" == *"#${i:1}"* ]]; then
echo -n "^bg($selcolor)^fg(#000000) ${i:1} ^fg()^bg()"
elif [[ "${TAGS2[@]}" == *"+${i:1}"* ]]; then
echo -n "^bg($locolor)^fg(#000000) ${i:1} ^fg()^bg()"
else
case ${i:0:1} in
'#')
echo -n "^bg($selcolor)^fg(#000000) ${i:1} ^fg()^bg()"
;;
'+')
echo -n "^bg($locolor)^fg(#000000) ${i:1} ^fg()^bg()"
;;
':')
echo -n "^bg($hicolor)^fg(#000000) ${i:1} ^fg()^bg()"
;;
'!')
echo -n "^bg($urcolor)^fg(#000000) ${i:1} ^fg()^bg()"
;;
*)
echo -n "^bg($bgcolor)^fg(#ffffff) ${i:1} ^fg()^bg()"
;;
esac
fi
echo -n "$separator"
done
}
function print_mailboxes() {
declare -A mailnames
mailboxes=(ninthfloor gmail aethon ryuslash.org)
mailnames=(
[ninthfloor]="9f"
[gmail]="gm"
[aethon]="aet"
[ryuslash.org]="ryu")
mailtxt=""
for j in "${mailboxes[@]}"; do
mailfile="$HOME/documents/mail/$j/inbox/new/"
mailcnt=$(ls $mailfile | wc -l)
if [ $mailcnt -gt 0 ]; then
mailsha1=$(echo $j | sha1sum)
mailcolor="#${mailsha1:0:6}"
else
mailcolor=$bgcolor
fi
mailtxt="$mailtxt${separator}^bg($mailcolor)^fg(#ffffff) ${mailnames[$j]} ^fg()^bg()"
done
mailtxt_only=$(echo -n "$mailtxt" | sed 's.\^[^(]*([^)]*)..g')
let mailtxt_width=$(textwidth "$font" "$mailtxt_only")+10
echo -n "^p(_RIGHT)^p(-$mailtxt_width)$mailtxt"
}
function print_services() {
services=(emacs httpd mysqld dunst xbindkeys mpdscribble sshd mpd)
servicetxt=""
for j in "${services[@]}"; do
servicetxt="$servicetxt$separator$(status $j)"
done
servicetxt_only=$(echo -n "$servicetxt" | sed 's.\^[^(]*([^)]*)..g')
let servicetxt_width=($(textwidth "$font" "$servicetxt_only")+7)/2
echo -n "^p(_CENTER)^p(-$servicetxt_width)$servicetxt"
}
function status()
{
running=$(${1}_running 2>/dev/null || pidof $1)
if [ -n "$running" ]; then
color="darkgreen"
else
color="darkred"
fi
echo -n "^bg($color)^fg(#ffffff) $1 ^fg()^bg()"
}
function emacs_running()
{
ps ax | awk '{ print $5 " " $6 }' | grep -E "^emacs --daemon"
}
{
childpid=$!
herbstclient --idle
kill $childpid
} 2> /dev/null | {
TAGS=( $(herbstclient tag_status $monitor) )
TAGS2=( $(herbstclient tag_status $monitor2) )
separator="^fg($bgcolor)^ro(1x$height)^fg()"
print_tags
print_services
print_mailboxes
echo
# wait for next event
read line || break
cmd=( $line )
# find out event origin
case "${cmd[0]}" in
tag*)
TAGS=( $(herbstclient tag_status $monitor) )
TAGS2=( $(herbstclient tag_status $monitor2) )
;;
quit_panel)
exit
;;
esac
sleep 1s
} 2> /dev/null | dzen2 -w $width -x $x -y $y -fn "$font" -h $height \
-ta l -bg "$bgcolor"
# Local Variables:
# eval: (git-auto-commit-mode 1)
# End:

27
.config/newsbeuter/config Normal file
View file

@ -0,0 +1,27 @@
auto-reload yes
reload-threads 3
reload-time 60
browser firefox
confirm-exit yes
feedlist-format "%-35t %?d?- %-35d&? %> %u"
articlelist-format "%-4i %f %t"
feedlist-title-format "%N %V %> %u feeds with new articles"
articlelist-title-format "%T"
max-items 500
show-read-feeds no
show-read-articles no
html-renderer "w3m -dump -T text/HTML -cols 72"
color listfocus default red
color info default black bold
highlight article "^(Feed|Title|Author|Link|Date):.*" yellow default bold
article-sort-order date-desc

311
.conky_box.lua Normal file
View file

@ -0,0 +1,311 @@
--[[BOX WIDGET v1.1 by Wlourf 27/01/2011
This widget can drawn some boxes, even circles in your conky window
http://u-scripts.blogspot.com/2011/01/box-widget.html)
Inspired by Background by londonali1010 (2009), thanks ;-)
The parameters (all optionals) are :
x - x coordinate of top-left corner of the box, default = 0 = (top-left corner of conky window)
y - y coordinate of top-left corner of the box, default = 0 = (top-left corner of conky window)
w - width of the box, default = width of the conky window
h - height of the box, default = height of the conky window
corners - corners is a table for the four corners in this order : top-left, top-right,bottom-right, bottom-left
each corner is defined in a table with a shape and a radius, available shapes are : "curve","circle","line"
example for the same shapes for all corners:
{ {"circle",10} }
example for first corner different from the three others
{ {"circle",10}, {"circle",5} }
example for top corners differents from bottom corners
{ {"circle",10}, {"circle",10}, {"line",0} }
default = { {"line",0} } i.e=no corner
operator - set the compositing operator (needs in the conkyrc : own_window_argb_visual yes)
see http://cairographics.org/operators/
available operators are :
"clear","source","over","in","out","atop","dest","dest_over","dest_in","dest_out","dest_atop","xor","add","saturate"
default = "over"
border - if border>0, the script draws only the border, like a frame, default=0
dash - if border>0 and dash>0, the border is draw with dashes, default=0
skew_x - skew box around x axis, default = 0
skew_y - skew box around y axis, default = 0
scale_x - rescale the x axis, default=1, useful for drawing elipses ...
scale_y - rescale the x axis, default=1
angle - angle of rotation of the box in degrees, default = 0
i.e. a horizontal graph
rot_x - x point of rotation's axis, default = 0,
relative to top-left corner of the box, (not the conky window)
rot_y - y point of rotation's axis, default = 0
relative to top-left corner of the box, (not the conky window)
draw_me - if set to false, box is not drawn (default = true or 1)
it can be used with a conky string, if the string returns 1, the box is drawn :
example : "${if_empty ${wireless_essid wlan0}}${else}1$endif",
linear_gradient - table with the coordinates of two points to define a linear gradient,
points are relative to top-left corner of the box, (not the conky window)
{x1,y1,x2,y2}
radial_gradient - table with the coordinates of two circle to define a radial gradient,
points are relative to top-left corner of the box, (not the conky window)
{x1,y1,r1,x2,y2,r2} (r=radius)
colour - table of colours, default = plain white {{1,0xFFFFFF,0.5}}
this table contains one or more tables with format {P,C,A}
P=position of gradient (0 = start of the gradient, 1= end of the gradient)
C=hexadecimal colour
A=alpha (opacity) of color (0=invisible,1=opacity 100%)
Examples :
for a plain color {{1,0x00FF00,0.5}}
for a gradient with two colours {{0,0x00FF00,0.5},{1,0x000033,1}} {x=80,y=150,w=20,h=20,
radial_gradient={20,20,0,20,20,20},
colour={{0.5,0xFFFFFF,1},{1,0x000000,0}},
or {{0.5,0x00FF00,1},{1,0x000033,1}} -with this one, gradient will start in the middle
for a gradient with three colours {{0,0x00FF00,0.5},{0.5,0x000033,1},{1,0x440033,1}}
and so on ...
To call this script in Conky, use (assuming you have saved this script to ~/scripts/):
lua_load ~/scripts/box.lua
lua_draw_hook_pre main_box
And leave one line blank or not after TEXT
Changelog:
+ v1.0 -- Original release (19.12.2010)
+ v1.1 -- Adding parameters: operator, dash, angle, skew_x, skew_y, draw_me
corners are described in a table
-- 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 version 3 (GPLv3)
--
-- 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.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-- MA 02110-1301, USA.
]]
require 'cairo'
function conky_main_box()
if conky_window==nil then return end
---------------------- PARAMETERS BEGIN HERE
local boxes_settings={
{
x = conky_window.text_start_x - 10,
y = conky_window.text_start_y - 10,
w = conky_window.text_width + 20,
h = conky_window.text_height + 20,
colour = {{1,0x000000,0.4}},
},
}
---------------------------- PARAMETERS END HERE
local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
local cr=cairo_create(cs)
if tonumber(conky_parse("$updates"))<5 then return end
for i in pairs(boxes_settings) do
draw_box (cr,boxes_settings[i])
end
cairo_destroy(cr)
cairo_surface_destroy(cs)
end
function draw_box(cr,t)
if t.draw_me == true then t.draw_me = nil end
if t.draw_me ~= nil and conky_parse(tostring(t.draw_me)) ~= "1" then return end
local table_corners={"circle","curve","line"}
local t_operators={
clear = CAIRO_OPERATOR_CLEAR,
source = CAIRO_OPERATOR_SOURCE,
over = CAIRO_OPERATOR_OVER,
["in"] = CAIRO_OPERATOR_IN,
out = CAIRO_OPERATOR_OUT,
atop = CAIRO_OPERATOR_ATOP,
dest = CAIRO_OPERATOR_DEST,
dest_over = CAIRO_OPERATOR_DEST_OVER,
dest_in = CAIRO_OPERATOR_DEST_IN,
dest_out = CAIRO_OPERATOR_DEST_OUT,
dest_atop = CAIRO_OPERATOR_DEST_ATOP,
xor = CAIRO_OPERATOR_XOR,
add = CAIRO_OPERATOR_ADD,
saturate = CAIRO_OPERATOR_SATURATE,
}
function rgba_to_r_g_b_a(tc)
--tc={position,colour,alpha}
local colour = tc[2]
local alpha = tc[3]
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
function table.copy(t)
local t2 = {}
for k,v in pairs(t) do
t2[k] = {v[1],v[2]}
end
return t2
end
function draw_corner(num,t)
local shape=t[1]
local radius=t[2]
local x,y = t[3],t[4]
if shape=="line" then
if num == 1 then cairo_line_to(cr,radius,0)
elseif num == 2 then cairo_line_to(cr,x,radius)
elseif num == 3 then cairo_line_to(cr,x-radius,y)
elseif num == 4 then cairo_line_to(cr,0,y-radius)
end
end
if shape=="circle" then
local PI = math.pi
if num == 1 then cairo_arc(cr,radius,radius,radius,-PI,-PI/2)
elseif num == 2 then cairo_arc(cr,x-radius,y+radius,radius,-PI/2,0)
elseif num == 3 then cairo_arc(cr,x-radius,y-radius,radius,0,PI/2)
elseif num == 4 then cairo_arc(cr,radius,y-radius,radius,PI/2,-PI)
end
end
if shape=="curve" then
if num == 1 then cairo_curve_to(cr,0,radius ,0,0 ,radius,0)
elseif num == 2 then cairo_curve_to(cr,x-radius,0, x,y, x,radius)
elseif num == 3 then cairo_curve_to(cr,x,y-radius, x,y, x-radius,y)
elseif num == 4 then cairo_curve_to(cr,radius,y, x,y, 0,y-radius)
end
end
end
--check values and set default values
if t.x == nil then t.x = 0 end
if t.y == nil then t.y = 0 end
if t.w == nil then t.w = conky_window.width end
if t.h == nil then t.h = conky_window.height end
if t.radius == nil then t.radius = 0 end
if t.border == nil then t.border = 0 end
if t.colour==nil then t.colour={{1,0xFFFFFF,0.5}} end
if t.linear_gradient ~= nil then
if #t.linear_gradient ~= 4 then
t.linear_gradient = {t.x,t.y,t.width,t.height}
end
end
if t.angle==nil then t.angle = 0 end
if t.skew_x == nil then t.skew_x=0 end
if t.skew_y == nil then t.skew_y=0 end
if t.scale_x==nil then t.scale_x=1 end
if t.scale_y==nil then t.scale_y=1 end
if t.rot_x == nil then t.rot_x=0 end
if t.rot_y == nil then t.rot_y=0 end
if t.operator == nil then t.operator = "over" end
if (t_operators[t.operator]) == nil then
print ("wrong operator :",t.operator)
t.operator = "over"
end
if t.radial_gradient ~= nil then
if #t.radial_gradient ~= 6 then
t.radial_gradient = {t.x,t.y,0, t.x,t.y, t.width}
end
end
for i=1, #t.colour do
if #t.colour[i]~=3 then
print ("error in color table")
t.colour[i]={1,0xFFFFFF,1}
end
end
if t.corners == nil then t.corners={ {"line",0} } end
local t_corners = {}
local t_corners = table.copy(t.corners)
--don't use t_corners=t.corners otherwise t.corners is altered
--complete the t_corners table if needed
for i=#t_corners+1,4 do
t_corners[i]=t_corners[#t_corners]
local flag=false
for j,v in pairs(table_corners) do flag=flag or (t_corners[i][1]==v) end
if not flag then print ("error in corners table :",t_corners[i][1]);t_corners[i][1]="curve" end
end
--this way :
-- t_corners[1][4]=x
-- t_corners[2][3]=y
--doesn't work
t_corners[1]={t_corners[1][1],t_corners[1][2],0,0}
t_corners[2]={t_corners[2][1],t_corners[2][2],t.w,0}
t_corners[3]={t_corners[3][1],t_corners[3][2],t.w,t.h}
t_corners[4]={t_corners[4][1],t_corners[4][2],0,t.h}
t.no_gradient = (t.linear_gradient == nil ) and (t.radial_gradient == nil )
cairo_save(cr)
cairo_translate(cr, t.x, t.y)
if t.rot_x~=0 or t.rot_y~=0 or t.angle~=0 then
cairo_translate(cr,t.rot_x,t.rot_y)
cairo_rotate(cr,t.angle*math.pi/180)
cairo_translate(cr,-t.rot_x,-t.rot_y)
end
if t.scale_x~=1 or t.scale_y~=1 or t.skew_x~=0 or t.skew_y~=0 then
local matrix0 = cairo_matrix_t:create()
tolua.takeownership(matrix0)
cairo_matrix_init (matrix0, t.scale_x,math.pi*t.skew_y/180 , math.pi*t.skew_x/180 ,t.scale_y,0,0)
cairo_transform(cr,matrix0)
end
local tc=t_corners
cairo_move_to(cr,tc[1][2],0)
cairo_line_to(cr,t.w-tc[2][2],0)
draw_corner(2,tc[2])
cairo_line_to(cr,t.w,t.h-tc[3][2])
draw_corner(3,tc[3])
cairo_line_to(cr,tc[4][2],t.h)
draw_corner(4,tc[4])
cairo_line_to(cr,0,tc[1][2])
draw_corner(1,tc[1])
if t.no_gradient then
cairo_set_source_rgba(cr,rgba_to_r_g_b_a(t.colour[1]))
else
if t.linear_gradient ~= nil then
pat = cairo_pattern_create_linear (t.linear_gradient[1],t.linear_gradient[2],t.linear_gradient[3],t.linear_gradient[4])
elseif t.radial_gradient ~= nil then
pat = cairo_pattern_create_radial (t.radial_gradient[1],t.radial_gradient[2],t.radial_gradient[3],
t.radial_gradient[4],t.radial_gradient[5],t.radial_gradient[6])
end
for i=1, #t.colour do
cairo_pattern_add_color_stop_rgba (pat, t.colour[i][1], rgba_to_r_g_b_a(t.colour[i]))
end
cairo_set_source (cr, pat)
cairo_pattern_destroy(pat)
end
cairo_set_operator(cr,t_operators[t.operator])
if t.border>0 then
cairo_close_path(cr)
if t.dash ~= nil then cairo_set_dash(cr, t.dash, 1, 0.0) end
cairo_set_line_width(cr,t.border)
cairo_stroke(cr)
else
cairo_fill(cr)
end
cairo_restore(cr)
end

53
.conkyrc Normal file
View file

@ -0,0 +1,53 @@
# -*- eval: (git-auto-commit-mode 1) -*-
background yes
use_xft yes
xftfont tamsyn:pixelsize=14
!xftalpha 0.1
update_interval 2.0
total_run_times 0
double_buffer yes
minimum_size 250 5
maximum_width 400
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color gray
default_shade_color red
default_outline_color green
alignment top_right
gap_x 10
gap_y 42
no_buffers yes
uppercase no
cpu_avg_samples 2
net_avg_samples 1
override_utf8_locale no
use_spacer yes
lua_load ~/.conkybox.lua
lua_draw_hook_pre conky_main_box
TEXT
${font Arial:bold:size=10}${color Tan1}TODO ${color RoyalBlue}${voffset -2}${hr 2}
$font${color SlateGray}${exec /home/slash/development/projects/ntd/src/ntd list short}
$if_mpd_playing${font Arial:bold:size=10}${color Tan1}MUSIC ${color RoyalBlue}${voffset -2}${hr 2}
$font$alignc${color SlateGray}$mpd_title
$alignc$mpd_artist
$alignc$mpd_album
$mpd_bar
$endif${font Arial:bold:size=10}${color Tan1}USAGE ${color RoyalBlue}${voffset -2}${hr 2}
$font${color SlateGray}CPU1 $alignr${cpu cpu1}% ${cpubar cpu1 7,170}
$font${color SlateGray}CPU2 $alignr${cpu cpu2}% ${cpubar cpu2 7,170}
$font${color SlateGray}MEM $alignr${memperc}% ${membar 7,170}
$font${color SlateGray}SWAP $alignr${swapperc}% ${swapbar 7, 170}
${font Arial:bold:size=10}${color Tan1}HDD ${color RoyalBlue}${voffset -2}${hr 2}
${font}${color SlateGray}Write: $alignr$diskio_write
Read: $alignr$diskio_read
${font Arial:bold:size=10}${color Tan1}TOP PROCESS ${color RoyalBlue}${voffset -2}${hr 2}
${color SlateGray}${font}CPU: ${top name 1}${alignr}${top cpu 1}%
MEM: ${top_mem name 1}${alignr}${top_mem mem 1}%
IO: ${top_io name 1}${alignr}${top_io io_perc 1}%

276
.emacs.d/icons/cl.xpm Normal file
View file

@ -0,0 +1,276 @@
/* XPM */
static char * cl_xpm[] = {
"23 16 257 2",
" c None",
". c #122C44",
"+ c #112B43",
"@ c #112B44",
"# c #132D45",
"$ c #132F48",
"% c #14304A",
"& c #133049",
"* c #132F49",
"= c #122C45",
"- c #122C46",
"; c #122D45",
"> c #132E46",
", c #14314C",
"' c #14324D",
") c #15334E",
"! c #15344F",
"~ c #14324E",
"{ c #15324D",
"] c #13304B",
"^ c #14304B",
"/ c #14314B",
"( c #112E49",
"_ c #244054",
": c #233F54",
"< c #12304D",
"[ c #103050",
"} c #0D2E4F",
"| c #123352",
"1 c #183854",
"2 c #214059",
"3 c #163653",
"4 c #163553",
"5 c #163552",
"6 c #153452",
"7 c #1A3954",
"8 c #4D686E",
"9 c #6D857F",
"0 c #203E56",
"a c #143350",
"b c #112F4B",
"c c #305065",
"d c #678280",
"e c #8AA291",
"f c #3F5E6D",
"g c #2E4E65",
"h c #678380",
"i c #41606D",
"j c #193C5A",
"k c #183A59",
"l c #183959",
"m c #173959",
"n c #163857",
"o c #143656",
"p c #163757",
"q c #123454",
"r c #91A894",
"s c #768F87",
"t c #1E3E5A",
"u c #163756",
"v c #173754",
"w c #6D8580",
"x c #B8CCAA",
"y c #CDE0B4",
"z c #99B19C",
"A c #D0E2B5",
"B c #38596D",
"C c #7F998F",
"D c #627F81",
"E c #173B5D",
"F c #193D5E",
"G c #1A3E5E",
"H c #1C405F",
"I c #33546A",
"J c #537179",
"K c #2E4F67",
"L c #A2B89F",
"M c #406070",
"N c #14395B",
"O c #183C5D",
"P c #193C5D",
"Q c #193C5C",
"R c #183958",
"S c #8CA595",
"T c #385B71",
"U c #A5BCA2",
"V c #C8DAB1",
"W c #D4E5B6",
"X c #4F6F7B",
"Y c #668384",
"Z c #5B797F",
"` c #1E4264",
" . c #2C506A",
".. c #55737C",
"+. c #A5BBA1",
"@. c #B4C9A8",
"#. c #8CA697",
"$. c #9AB29D",
"%. c #B7CCA9",
"&. c #506F7A",
"*. c #153B5F",
"=. c #1A3F61",
"-. c #1A3F60",
";. c #1A3E60",
">. c #A7BDA2",
",. c #466777",
"'. c #32556E",
"). c #6A8787",
"!. c #AAC0A4",
"~. c #C9DCB2",
"{. c #C3D7AF",
"]. c #77948D",
"^. c #89A396",
"/. c #B6CBAA",
"(. c #B9CDAB",
"_. c #75918C",
":. c #53737E",
"<. c #76928E",
"[. c #3C5E73",
"}. c #678486",
"|. c #839D93",
"1. c #31556D",
"2. c #163C62",
"3. c #1A4064",
"4. c #1B4164",
"5. c #A8BDA1",
"6. c #839E94",
"7. c #274C6A",
"8. c #32566F",
"9. c #30546D",
"0. c #54747D",
"a. c #7F9990",
"b. c #95AD9A",
"c. c #87A194",
"d. c #5B7A80",
"e. c #406275",
"f. c #809B92",
"g. c #CCDFB6",
"h. c #CDE0B6",
"i. c #4F6F7C",
"j. c #7C9790",
"k. c #A5BDA4",
"l. c #77928E",
"m. c #34566E",
"n. c #173D62",
"o. c #194063",
"p. c #92A995",
"q. c #D3E6B9",
"r. c #BCD0AE",
"s. c #C1D5B0",
"t. c #A9BFA4",
"u. c #4A6B79",
"v. c #153C61",
"w. c #1D4365",
"x. c #31546D",
"y. c #6B8988",
"z. c #B5CAAA",
"A. c #D3E5B8",
"B. c #D6E8BA",
"C. c #C8DCB4",
"D. c #8FA899",
"E. c #7E9A91",
"F. c #A7BEA4",
"G. c #C6DAB2",
"H. c #9BB39E",
"I. c #5F7E82",
"J. c #3A5C71",
"K. c #1C4264",
"L. c #BCCFAB",
"M. c #D2E4B7",
"N. c #D1E3B6",
"O. c #CCDEB4",
"P. c #6E8A8A",
"Q. c #718E8B",
"R. c #A7BEA3",
"S. c #D3E5B7",
"T. c #C4D7B1",
"U. c #CBDDB4",
"V. c #D0E2B6",
"W. c #D3E6B8",
"X. c #D0E3B6",
"Y. c #BED3AE",
"Z. c #BFD2AE",
"`. c #8DA492",
" + c #C9DCB1",
".+ c #D0E1B4",
"++ c #CFE1B4",
"@+ c #93AB9A",
"#+ c #CDDFB3",
"$+ c #93AC99",
"%+ c #3D5F73",
"&+ c #9BB39D",
"*+ c #A1B8A0",
"=+ c #C2D6AE",
"-+ c #CFE1B5",
";+ c #CCDFB4",
">+ c #6F8C89",
",+ c #79958E",
"'+ c #698687",
")+ c #BED1AD",
"!+ c #D4E6B7",
"~+ c #ABC1A3",
"{+ c #94AA95",
"]+ c #C2D4AC",
"^+ c #CBDDB1",
"/+ c #6E8B89",
"(+ c #8CA695",
"_+ c #D9E8B7",
":+ c #617E82",
"<+ c #92AA98",
"[+ c #D1E3B4",
"}+ c #B5CAA7",
"|+ c #87A193",
"1+ c #B5CAA8",
"2+ c #96AE9A",
"3+ c #98B09C",
"4+ c #486878",
"5+ c #52717C",
"6+ c #738F8B",
"7+ c #59777C",
"8+ c #869E8E",
"9+ c #A7BC9F",
"0+ c #ADC2A3",
"a+ c #D5E5B4",
"b+ c #B8CBA8",
"c+ c #51717B",
"d+ c #BFD1AB",
"e+ c #CADCB0",
"f+ c #A4BA9F",
"g+ c #56757E",
"h+ c #9BB29B",
"i+ c #496A78",
"j+ c #3E6074",
"k+ c #A0B79E",
"l+ c #88A293",
"m+ c #99B09A",
"n+ c #708B87",
"o+ c #7A938A",
"p+ c #A6BB9E",
"q+ c #92AA97",
"r+ c #486877",
"s+ c #648183",
"t+ c #A0B69D",
"u+ c #5F7D81",
"v+ c #3D6072",
"w+ c #C6D8AD",
"x+ c #476776",
"y+ c #4B6C78",
"z+ c #4F6D76",
"A+ c #769089",
"B+ c #80998D",
"C+ c #819A8E",
"D+ c #95AC97",
"E+ c #8BA393",
"F+ c #A0B59B",
"G+ c #93AB96",
"H+ c #668282",
" . . . . + @ + . # ",
" $ % & * * % = - . . ; > $ ",
" , ' ) ! ~ { { ' , , ] ^ / ^ ( _ : ",
" < [ } | 1 2 3 4 4 3 5 5 5 6 7 8 9 0 a ",
" b c d e f g h i j k l m n o p q r s t u v ",
" w x y z A B C D E F G H I J K L M N O P Q R ",
" S T U V W X Y Z ` ...+.@.#.$.%.&.*.=.=.-.;.",
" >.,.'.).!.~.{.].^./.(._.:.<.[.}.|.1.2.3.4.4.",
" 5.6.7.8.9.0.a.b.c.d.e.f.g.h.i.j.k.l.m.n.n.o.",
" p.q.r.s.t.u.v.w.x.y.z.A.B.C.D.E.F.G.H.I.J.K.",
" L.A.M.N.O.P.Q.R./.M.M.M.S.T.U.M.V.W.X.Y.Z.",
" `. +.+++@+_.#+$+%+&+#+*+=+-+;+>+,+'+)+!+~+",
" {+]+^+/+(+_+:+<+[+}+|+1+2+3+4+5+6+z L.7+",
" 8+9+0+a+b+c+d+e+f+g+h+i+j+k+J.l+m+n+ ",
" o+p+q+r+s+Y t+J.t+u+v+w+x+y+ ",
" z+A+B+C+D+E+F+G+C+H+ "};

189
.emacs.d/icons/emacs.xpm Normal file
View file

@ -0,0 +1,189 @@
/* XPM */
static char * emacs_xpm[] = {
"16 16 170 2",
" c None",
". c #5551AB",
"+ c #5652AB",
"@ c #5853AC",
"# c #504CA8",
"$ c #4C47A7",
"% c #5752AA",
"& c #534FA8",
"* c #5652A8",
"= c #6460AF",
"- c #6E6BB5",
"; c #8380BF",
"> c #928FC7",
", c #9794CA",
"' c #8784C3",
") c #5A55AE",
"! c #5753AA",
"~ c #6D6AB3",
"{ c #9593C8",
"] c #9D9BCC",
"^ c #9895CA",
"/ c #9A97CB",
"( c #A2A0CF",
"_ c #BBB9DB",
": c #F4F4F8",
"< c #D1D0E8",
"[ c #5E59AF",
"} c #5854A9",
"| c #5954A9",
"1 c #5955A9",
"2 c #BCBADC",
"3 c #F6F5FA",
"4 c #EFEEF7",
"5 c #F0F0F7",
"6 c #E9E8F4",
"7 c #DFDFEE",
"8 c #D8D8EB",
"9 c #F2F2F9",
"0 c #FAFAFD",
"a c #7B77BB",
"b c #4F4BA7",
"c c #5A57AA",
"d c #6461AF",
"e c #A19FCE",
"f c #F0F0F8",
"g c #E3E3F1",
"h c #B9B8DA",
"i c #B9B8DB",
"j c #BCBBDC",
"k c #C3C2E0",
"l c #CBCAE5",
"m c #AAA8D3",
"n c #5F5BAC",
"o c #5651A8",
"p c #5955AA",
"q c #5956AA",
"r c #5C59AB",
"s c #6B68B3",
"t c #7C7ABB",
"u c #B8B7DB",
"v c #EBEAF5",
"w c #B1B0D7",
"x c #908EC6",
"y c #908DC5",
"z c #8581C0",
"A c #726FB6",
"B c #5E5BAC",
"C c #5B56AA",
"D c #5B57AB",
"E c #5653A8",
"F c #7574B8",
"G c #8280BE",
"H c #B0AED7",
"I c #E1E1EF",
"J c #BDBBDD",
"K c #8481BF",
"L c #7571B7",
"M c #6A68B2",
"N c #625FAD",
"O c #5C58AB",
"P c #5B57AA",
"Q c #7A78BB",
"R c #ADACD5",
"S c #C8C7E3",
"T c #D4D3E9",
"U c #D0CFE7",
"V c #D5D5EA",
"W c #ECEDF6",
"X c #7B79BB",
"Y c #6664B0",
"Z c #625FAE",
"` c #5551A7",
" . c #918EC7",
".. c #F3F3FA",
"+. c #F5F4FA",
"@. c #F4F3F9",
"#. c #E7E6F3",
"$. c #C7C7E2",
"%. c #B2B0D7",
"&. c #B3B2D8",
"*. c #9593C9",
"=. c #6663AF",
"-. c #5F5DAD",
";. c #5B59AB",
">. c #534FA6",
",. c #F4F3FA",
"'. c #C9C8E4",
"). c #7675B9",
"!. c #6C6AB3",
"~. c #706EB5",
"{. c #716FB6",
"]. c #6E6CB4",
"^. c #6968B1",
"/. c #6462AF",
"(. c #5B58AB",
"_. c #5A56AA",
":. c #5855A9",
"<. c #6D6BB4",
"[. c #D1D0E7",
"}. c #F2F1F8",
"|. c #B7B6DA",
"1. c #6765B0",
"2. c #6F6EB5",
"3. c #7B7ABB",
"4. c #807EBE",
"5. c #807EBD",
"6. c #7876B9",
"7. c #615EAE",
"8. c #5754A8",
"9. c #6A67B2",
"0. c #B4B3D8",
"a. c #EAEAF4",
"b. c #DADAEC",
"c. c #B0B0D6",
"d. c #9998CB",
"e. c #8988C2",
"f. c #7F7EBD",
"g. c #7978BA",
"h. c #7472B8",
"i. c #6B68B2",
"j. c #5D5AAC",
"k. c #5755A8",
"l. c #8A88C2",
"m. c #C9C7E3",
"n. c #E4E4F2",
"o. c #EAE9F4",
"p. c #E0E0EF",
"q. c #CECEE6",
"r. c #AFAED6",
"s. c #8A89C3",
"t. c #6865B1",
"u. c #615FAE",
"v. c #918FC6",
"w. c #AAA9D4",
"x. c #B9B8DC",
"y. c #CDCCE5",
"z. c #F5F5FA",
"A. c #FFFFFF",
"B. c #E7E7F3",
"C. c #706DB5",
"D. c #7E7CBC",
"E. c #908FC5",
"F. c #9C9BCC",
"G. c #A2A1CF",
"H. c #A09ECE",
"I. c #9390C6",
"J. c #7977BA",
"K. c #5D59AB",
"L. c #5552A8",
"M. c #5451A7",
" . + @ . # $ ",
" % & * = - ; > , ' ) ",
" ! * ~ { ] ^ / ( _ : < [ ",
" } | 1 2 3 4 5 6 7 8 9 0 a b ",
" } c d e f g h i j k l m n o ",
"p q r s t u v w x y z A B C 1 ! ",
"q D E B F G H I J K L M N O q } ",
"P * Q R S T U V W S X Y Z r c 1 ",
"` ...+.@.#.$.u %.&.*.=.-.;.P p ",
">.&.,.f '.).!.~.{.].^./.B r (._.",
":.<.[.}.|.1.2.3.4.5.6.<.7.r (._.",
" 8.9.0.a.b.c.d.e.f.g.h.i.j.c ",
" j.q k.l.m.n.o.p.q.r.s.t.r D ",
" r u.h.v.w.x.y.z.A.B.C.} ",
" B !.D.E.F.G.H.I.J.K. ",
" :.8.8.8.L.M. "};

334
.emacs.d/icons/php.xpm Normal file
View file

@ -0,0 +1,334 @@
/* XPM */
static char * php_xpm[] = {
"30 16 315 2",
" c None",
". c #D9D7E1",
"+ c #CAC9D8",
"@ c #B6B5CC",
"# c #A5A4C3",
"$ c #9697BA",
"% c #8C8DB4",
"& c #8283AE",
"* c #787BA8",
"= c #6D70A1",
"- c #606598",
"; c #5F6390",
"> c #636588",
", c #C7C5D6",
"' c #BFBED5",
") c #AAABCC",
"! c #9193C0",
"~ c #7E81B7",
"{ c #767AB4",
"] c #7478B3",
"^ c #8185BE",
"/ c #8488C0",
"( c #777BB5",
"_ c #777BB4",
": c #777BB3",
"< c #7579B1",
"[ c #7275A9",
"} c #6F709C",
"| c #6A6A89",
"1 c #626175",
"2 c #A8A6C2",
"3 c #9F9FC3",
"4 c #8789BB",
"5 c #6E73B1",
"6 c #7075B1",
"7 c #7379B2",
"8 c #7377B3",
"9 c #8387BD",
"0 c #636474",
"a c #595965",
"b c #898CBC",
"c c #7479B4",
"d c #787CB7",
"e c #787CB9",
"f c #7376A9",
"g c #656788",
"h c #545463",
"i c #9090B6",
"j c #8083B6",
"k c #7176B2",
"l c #7578B4",
"m c #787CB5",
"n c #797DB5",
"o c #7A7DB6",
"p c #7B7FB8",
"q c #757AB7",
"r c #9193BF",
"s c #070705",
"t c #1F1F1E",
"u c #878BBD",
"v c #797DB7",
"w c #797DB6",
"x c #7B80BA",
"y c #7D82C0",
"z c #7174A7",
"A c #50526A",
"B c #2D2E36",
"C c #7A7DA5",
"D c #8182B0",
"E c #757AB3",
"F c #7579B5",
"G c #7D80B1",
"H c #6C6D86",
"I c #57596B",
"J c #58596C",
"K c #6A6C86",
"L c #8185B8",
"M c #7F82A3",
"N c #060607",
"O c #28282A",
"P c #5C5E70",
"Q c #5B5C70",
"R c #6E718E",
"S c #8083B5",
"T c #7A7DA1",
"U c #5A5B6D",
"V c #57596C",
"W c #57586A",
"X c #606177",
"Y c #787B9F",
"Z c #7F83BD",
"` c #7B7FBB",
" . c #4D4F6E",
".. c #13141B",
"+. c #7679A9",
"@. c #767AB5",
"#. c #7579B3",
"$. c #74769C",
"%. c #21211E",
"&. c #10100C",
"*. c #333334",
"=. c #232221",
"-. c #080803",
";. c #5F606D",
">. c #6F7082",
",. c #040405",
"'. c #212123",
"). c #2D2E2F",
"!. c #191916",
"~. c #0E0D0B",
"{. c #6C6D7E",
"]. c #5A5B6A",
"^. c #010000",
"/. c #272727",
"(. c #2F2F30",
"_. c #0F0F0B",
":. c #232321",
"<. c #747798",
"[. c #7C80BA",
"}. c #7E83C1",
"|. c #383A55",
"1. c #64699A",
"2. c #7679B2",
"3. c #767AB3",
"4. c #7D82BB",
"5. c #686A89",
"6. c #0D0C08",
"7. c #4E4F5F",
"8. c #8F92C1",
"9. c #8487AD",
"0. c #1D1E24",
"a. c #1C1C1A",
"b. c #4D4D4E",
"c. c #010100",
"d. c #7D7F97",
"e. c #8487BA",
"f. c #646579",
"g. c #54545A",
"h. c #43434C",
"i. c #1A1B20",
"j. c #8C90C0",
"k. c #56576A",
"l. c #000000",
"m. c #565769",
"n. c #7A7EB5",
"o. c #7B80BB",
"p. c #7276AD",
"q. c #14151F",
"r. c #64699D",
"s. c #7E82B9",
"t. c #5B5D73",
"u. c #0E0E0A",
"v. c #666887",
"w. c #878BD1",
"x. c #8F93C5",
"y. c #25252D",
"z. c #272726",
"A. c #12110F",
"B. c #8A8DB8",
"C. c #7E83C4",
"D. c #626479",
"E. c #050505",
"F. c #63646E",
"G. c #2F2F31",
"H. c #2F303B",
"I. c #8C90C7",
"J. c #8A8FD2",
"K. c #62647C",
"L. c #060501",
"M. c #5A5B70",
"N. c #7B7EB6",
"O. c #7F83C0",
"P. c #2D2F45",
"Q. c #65699C",
"R. c #787CB6",
"S. c #777BB6",
"T. c #7E81B5",
"U. c #464755",
"V. c #141313",
"W. c #6C6D88",
"X. c #8487B4",
"Y. c #56576C",
"Z. c #060606",
"`. c #5B5B5C",
" + c #8385B9",
".+ c #8387BF",
"++ c #45464F",
"@+ c #0A0A0B",
"#+ c #767783",
"$+ c #111211",
"%+ c #3F3F4A",
"&+ c #8B8EB7",
"*+ c #717496",
"=+ c #24252B",
"-+ c #1A1916",
";+ c #75789A",
">+ c #7A7EB8",
",+ c #7E84C0",
"'+ c #2F3047",
")+ c #636593",
"!+ c #7579B2",
"~+ c #797DB8",
"{+ c #7D80AF",
"]+ c #36363E",
"^+ c #232323",
"/+ c #262627",
"(+ c #181713",
"_+ c #454650",
":+ c #818292",
"<+ c #0A0A07",
"[+ c #4B4B53",
"}+ c #8287C0",
"|+ c #8387B9",
"1+ c #2C2C29",
"2+ c #171717",
"3+ c #7F808C",
"4+ c #141414",
"5+ c #2C2C2E",
"6+ c #696A82",
"7+ c #7E82B7",
"8+ c #767AB2",
"9+ c #171722",
"0+ c #6B6F9F",
"a+ c #7A7EB9",
"b+ c #7377A0",
"c+ c #202020",
"d+ c #202025",
"e+ c #616276",
"f+ c #5E5F77",
"g+ c #686A87",
"h+ c #8084B3",
"i+ c #8486AF",
"j+ c #63657E",
"k+ c #797B9F",
"l+ c #797EB9",
"m+ c #8185B7",
"n+ c #6C6E86",
"o+ c #71738D",
"p+ c #5F606E",
"q+ c #070707",
"r+ c #4F505E",
"s+ c #61627C",
"t+ c #76789D",
"u+ c #7F83B8",
"v+ c #8386C6",
"w+ c #3F405E",
"x+ c #64678F",
"y+ c #6D70A2",
"z+ c #7D81BC",
"A+ c #6D708F",
"B+ c #050500",
"C+ c #444653",
"D+ c #8C90C5",
"E+ c #7D81BB",
"F+ c #787CB4",
"G+ c #7D81B9",
"H+ c #7A7EB7",
"I+ c #7C80B8",
"J+ c #3B3C3E",
"K+ c #111113",
"L+ c #8082A8",
"M+ c #8185C1",
"N+ c #7B7FB9",
"O+ c #8084C2",
"P+ c #484B6E",
"Q+ c #13141D",
"R+ c #64668F",
"S+ c #6E719E",
"T+ c #7B7DA1",
"U+ c #5D5E6F",
"V+ c #77799B",
"W+ c #7C81BA",
"X+ c #7579B4",
"Y+ c #7D81B4",
"Z+ c #616379",
"`+ c #8185B6",
" @ c #7478B5",
".@ c #8084C3",
"+@ c #7073A9",
"@@ c #393A56",
"#@ c #151620",
"$@ c #6A6C94",
"%@ c #7375A5",
"&@ c #787BB2",
"*@ c #777CB6",
"=@ c #767BB4",
"-@ c #7C80B9",
";@ c #7A7FBC",
">@ c #7C80BD",
",@ c #7175A9",
"'@ c #4D4F70",
")@ c #21222F",
"!@ c #65678D",
"~@ c #696D97",
"{@ c #6F72A2",
"]@ c #7477AD",
"^@ c #777AB3",
"/@ c #787CB8",
"(@ c #787DB9",
"_@ c #777BB7",
":@ c #62658B",
"<@ c #4B4D64",
"[@ c #2F313A",
"}@ c #666785",
"|@ c #676888",
"1@ c #696B8D",
"2@ c #6C6D91",
"3@ c #6C6D92",
"4@ c #6D6E92",
"5@ c #6B6D8F",
"6@ c #696A8B",
"7@ c #656682",
"8@ c #5E5F75",
"9@ c #555463",
"0@ c #484750",
" . + @ # $ % & * = - ; > ",
" , ' ) ! ~ { ] ^ / ( { _ : < [ } | 1 ",
" 2 3 4 ] 5 6 7 8 9 0 a b c { { ( d e d f g h ",
" i j k l m n o p q r s t u v p ( m o w w x y z A B ",
" C D E F G H I I J K L M N O P Q R S T U V W X Y Z ` ... ",
" +.@.#.x $.%.&.*.=.-.;.>.,.'.).!.~.{.].^./.(._.:.<.[.}.|. ",
"1.2._ 3.4.5.6.7.8.9.0.a.b.c.d.e.f.^.g.h.i.M j.k.l.m.n.o.p.q.",
"r.m 3.{ s.t.u.v.w.x.y.t z.A.B.C.D.E.F.G.H.I.J.K.L.M.N.{ O.P.",
"Q.R.3.S.T.U.V.W.X.Y.Z.`.V.G. +.+++@+#+$+%+&+*+=+-+;+>+{ ,+'+",
")+!+( ~+{+]+c.^+/+(+_+:+<+[+}+|+1+2+3+l.4+5+a.z.6+7+_ >+8+9+",
" 0+d a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+r+K.s+t+u+_ R.v+w+ ",
" x+y+z+A+B+C+D+[.E+v F+G+H+3._ I+u J+K+L+M+G+N+{ ` O+P+Q+ ",
" R+S+T+U+V+W+X+{ 3.3.{ { : 3.{ Y+>.Z+`+ @3.~+.@+@@@#@ ",
" $@%@&@*@d ( ( _ 3.3.3.3.3.=@p -@~+;@>@,@'@)@ ",
" !@~@{@]@^@( d /@e (@(@/@_@{ z :@<@[@ ",
" }@|@1@2@3@4@5@6@7@8@9@0@ "};

173
.emacs.d/icons/python.xpm Normal file
View file

@ -0,0 +1,173 @@
/* XPM */
static char * python_xpm[] = {
"16 16 154 2",
" c None",
". c #4D8CBE",
"+ c #4787B8",
"@ c #4483B5",
"# c #417FB1",
"$ c #3E7BAD",
"% c #3B77A8",
"& c #508FBE",
"* c #BBD3E5",
"= c #73A2C7",
"- c #3F7CAE",
"; c #3C79A9",
"> c #3975A6",
", c #3672A2",
"' c #4B8ABA",
") c #A2C1DA",
"! c #6698C0",
"~ c #3F7DAE",
"{ c #3C79AA",
"] c #3976A5",
"^ c #3772A2",
"/ c #346E9E",
"( c #4686B7",
"_ c #4A85B5",
": c #4782B3",
"< c #3D7BAC",
"[ c #3A76A7",
"} c #3773A3",
"| c #346F9E",
"1 c #326C9B",
"2 c #4B8BBE",
"3 c #4888BA",
"4 c #4585B7",
"5 c #4381B3",
"6 c #407DAF",
"7 c #3D7AAB",
"8 c #3873A3",
"9 c #35709F",
"0 c #286499",
"a c #FFF46F",
"b c #FFE872",
"c c #FFE66E",
"d c #4B8CBE",
"e c #4889BB",
"f c #4382B3",
"g c #417FB0",
"h c #3873A4",
"i c #326C9C",
"j c #306998",
"k c #276499",
"l c #FFF26E",
"m c #FFE56D",
"n c #FFE366",
"o c #FFE162",
"p c #4888BC",
"q c #4685B8",
"r c #4482B4",
"s c #407FB1",
"t c #3E7BAC",
"u c #3B77A9",
"v c #3974A4",
"w c #3571A1",
"x c #336D9D",
"y c #306A99",
"z c #2F6897",
"A c #1F5F9B",
"B c #FFEA68",
"C c #FFE265",
"D c #FFE05E",
"E c #FFDE58",
"F c #4687B9",
"G c #3E7CAD",
"H c #3B78A8",
"I c #3472A6",
"J c #2C6BA3",
"K c #2A689F",
"L c #26649B",
"M c #25629A",
"N c #1D5E9C",
"O c #DCCE6E",
"P c #FEE162",
"Q c #FFDF5C",
"R c #FFDD56",
"S c #FFDB50",
"T c #427FB2",
"U c #3F7CAD",
"V c #3C78A9",
"W c #4B80A2",
"X c #FFF86B",
"Y c #FFF06F",
"Z c #FFF070",
"` c #FFEF6E",
" . c #FFEC67",
".. c #FFE762",
"+. c #FEE060",
"@. c #FFDE5A",
"#. c #FFDD53",
"$. c #FFDA4D",
"%. c #FFD848",
"&. c #4280B1",
"*. c #3C7AAA",
"=. c #3372A8",
"-. c #FFF36D",
";. c #FFE873",
">. c #FFE772",
",. c #FFE66F",
"'. c #FFE469",
"). c #FFE263",
"!. c #FFDF5D",
"~. c #FFDE57",
"{. c #FFDC51",
"]. c #FFD94B",
"^. c #FFD745",
"/. c #FFD540",
"(. c #296AA7",
"_. c #FFED70",
":. c #FFE367",
"<. c #FFE161",
"[. c #FFDF5B",
"}. c #FFDD55",
"|. c #FFDA4F",
"1. c #FFD849",
"2. c #FFD743",
"3. c #FFD43D",
"4. c #FFD43A",
"5. c #3B77A7",
"6. c #2566A4",
"7. c #FFEC6D",
"8. c #FFE46A",
"9. c #FFE264",
"0. c #FFDC52",
"a. c #FFD94C",
"b. c #FFD846",
"c. c #FFD43B",
"d. c #FFD33A",
"e. c #FEE368",
"f. c #FFE262",
"g. c #FFD641",
"h. c #FFD43C",
"i. c #FFE15F",
"j. c #FFDE59",
"k. c #FFDC53",
"l. c #FFD847",
"m. c #FFDA58",
"n. c #FFE58C",
"o. c #FFD33E",
"p. c #FFD53F",
"q. c #FFDF73",
"r. c #FFF6D7",
"s. c #FFD645",
"t. c #FFD94A",
"u. c #FFD643",
"v. c #FFD33B",
"w. c #FFD542",
" . + @ # $ % ",
" & * = # - ; > , ",
" ' ) ! ~ { ] ^ / ",
" ( _ : < [ } | 1 ",
" 2 3 4 5 6 7 [ 8 9 1 0 a b c ",
"d e ( f g < % h 9 i j k l m n o ",
"p q r s t u v w x y z A B C D E ",
"F @ g G H I J K L M N O P Q R S ",
"@ T U V W X Y Z ` ...+.@.#.$.%.",
"&.~ *.=.-.;.>.,.'.).!.~.{.].^./.",
"U 7 [ (._.b m :.<.[.}.|.1.2.3.4.",
" 5.} 6.7.8.9.D E 0.a.b./.c.d. ",
" e.f.Q R $.%.g.h. ",
" i.j.k.$.l.m.n.o. ",
" R {.].^.p.q.r.s. ",
" t.u.3.v.c.w. "};

22
.emacs.d/icons/scheme.xpm Normal file
View file

@ -0,0 +1,22 @@
/* XPM */
static char * scheme_xpm[] = {
"13 16 3 1",
" c None",
". c #7d7d7d",
"+ c #000000",
" .... ",
" .+++. ",
".+..++. ",
".+. .+. ",
" . .+. ",
" .+. ",
" .++. ",
" .+++. ",
" .+++. ",
" .++++. ",
" .++.++. ",
" .++..+. ",
" .++. .+. . ",
" .++. .++..+.",
".++. .+++. ",
" .. ... "};

View file

@ -21,6 +21,10 @@
'("/usr/share/emacs/site-lisp" "~/.emacs.d/site-lisp")) '("/usr/share/emacs/site-lisp" "~/.emacs.d/site-lisp"))
(add-to-list 'load-path "~/.emacs.d/")) (add-to-list 'load-path "~/.emacs.d/"))
(require 'ext)
(require 'mode-icons)
(require 'oni)
(autoload 'define-slime-contrib "slime") (autoload 'define-slime-contrib "slime")
(autoload 'gtags-mode "gtags" nil t) (autoload 'gtags-mode "gtags" nil t)
(autoload 'identica-mode "identica-mode" nil t) (autoload 'identica-mode "identica-mode" nil t)
@ -39,598 +43,8 @@
(define-key key-translation-map (kbd "C-j") (kbd "C-l")) (define-key key-translation-map (kbd "C-j") (kbd "C-l"))
(define-key key-translation-map (kbd "C-l") (kbd "C-j")) (define-key key-translation-map (kbd "C-l") (kbd "C-j"))
(defadvice org-agenda-redo (after org-agenda-redo-add-appts)
"Pressing `r' on the agenda will also add appointments."
(progn
(setq appt-time-msg-list nil)
(org-agenda-to-appt)))
(defalias 'yes-or-no-p 'y-or-n-p) (defalias 'yes-or-no-p 'y-or-n-p)
(defface oni:mode-line-buffer-column
'((t (:inherit font-lock-type-face)))
"Face for the column number in the mode-line"
:group 'local)
(defface oni:mode-line-buffer-line
'((t (:inherit font-lock-type-face)))
"Face for the line number in the mode-line"
:group 'local)
(defface oni:mode-line-buffer-position
'((t (:inherit font-lock-constant-face)))
"Face for the buffer position in the mode-line"
:group 'local)
(defface oni:mode-line-buffer-state
'((t (:inherit font-lock-preprocessor-face)))
"Face for the state of the buffer in the mode-line"
:group 'local)
(defface oni:mode-line-mode
'((t (:inherit font-lock-string-face)))
"Face for the major mode in the mode-line"
:group 'local)
(defface oni:mode-line-modified
'((t (:inherit font-lock-warning-face)))
"Face for the modified state in the mode-line"
:group 'local)
(defmacro oni:define-mailbox (name email &optional signature longname)
"Define a mailbox function for mailbox NAME with address EMAIL.
Optionally set signature to SIGNATURE and use LONGNAME as the
actual account name."
`(defun ,(make-symbol (concat "oni:" name "-mailbox")) ()
,(concat "Settings for " name " mailbox")
(setq mu4e-mu-home ,(expand-file-name (concat "~/.mu/" name))
mu4e-maildir ,(expand-file-name (concat "~/documents/mail/"
(or longname name)))
mu4e-get-mail-command ,(concat "offlineimap -oa " (or longname
name))
mu4e~main-buffer-name ,(concat "*mu4e-" name "*")
user-mail-address ,email
message-sendmail-extra-arguments '("-a" ,name)
message-signature-file ,signature)))
(defmacro oni:email (user at host dot com)
"Turn arguments into an email address.
The resulting email address will look like: USER@HOST.COM, AT and
DOT are intentionally being skipped."
(concat (symbol-name user) "@" (symbol-name host) "."
(symbol-name com)))
(defvar oni:mailbox-map
'("top" ("menu"
("ryulash.org" . "ryuslash")
("ninthfloor" . "ninthfloor")
("gmail" . "gmail")
("aethon" . "aethon")))
"A mailbox map for use with `tmm-prompt'.")
(defvar oni:required-packages
'(graphviz-dot-mode htmlize magit rainbow-delimiters
rainbow-mode yasnippet markdown-mode flymake
flymake-cursor pony-mode sauron dispass
expand-region fill-column-indicator
git-auto-commit-mode idomenu magit smex)
"List of all the packages I have (want) installed.")
(defun oni:after-save-func ()
"Function for `after-save-hook'."
(oni:compile-el)
(executable-make-buffer-file-executable-if-script-p)
(let ((dom-dir (locate-dominating-file (buffer-file-name) "Makefile")))
(when dom-dir
(shell-command (concat "make -C " dom-dir " TAGS >/dev/null 2>&1")))))
(defun oni:before-save-func ()
"Function for `before-save-hook'."
(if (eq major-mode 'html-mode)
(oni:replace-html-special-chars))
(if (not (eq major-mode 'markdown-mode))
(delete-trailing-whitespace)))
(defun oni:c-mode-common-func ()
"Function for `c-mode-common-hook'."
)
(defun oni:c-mode-func ()
"Function for `c-mode-hook'."
(local-set-key [f9] 'compile)
(local-set-key "\C-j" 'oni:newline-and-indent))
(defun oni:close-client-window ()
"Close a client's frames."
(interactive)
(server-save-buffers-kill-terminal nil))
(defun oni:compilation-finish-function (buffer str)
"Don't show compilation window if everything went OK."
(unless (string-match-p "exited abnormally" str)
;;(run-at-time 0.5 nil 'delete-windows-on buffer)
(delete-windows-on buffer)
(message "Compilation successful")))
(defun oni:compile-el ()
"Compile the current buffer file if it is an .el file."
(let* ((full-file-name (buffer-file-name))
(file-name (file-name-nondirectory full-file-name))
(suffix (file-name-extension file-name)))
(if (and (not (string-equal file-name ".dir-locals.el"))
(string-equal suffix "el"))
(byte-compile-file full-file-name))))
(defun oni:css-mode-func ()
"Function for `css-mode-hook'."
(local-set-key "\C-j" 'oni:newline-and-indent)
(rainbow-mode))
(defun oni:diary-display-func ()
"Function for `diary-display-hook'."
(diary-fancy-display))
(defun oni:emacs-lisp-mode-func ()
"Function for `emacs-lisp-mode-hook'."
(eldoc-mode))
(defun oni:emms-toggle-playing ()
"Toggle between playing/paused states."
(interactive)
(if (eq emms-player-playing-p nil)
(emms-start)
(emms-pause)))
(defun oni:erc-mode-func ()
"Function for `erc-mode-hook'."
(erc-fill-mode -1)
(visual-line-mode)
(setq truncate-lines nil))
(defun oni:eshell-mode-func ()
"Function for `eshell-mode-hook'."
(setq truncate-lines nil))
(defun oni:eshell-prompt-function ()
"Show a pretty shell prompt."
(let ((status (if (zerop eshell-last-command-status) ?+ ?-))
(hostname (shell-command-to-string "hostname"))
(dir (abbreviate-file-name (eshell/pwd)))
(branch
(shell-command-to-string
"git branch --contains HEAD 2>/dev/null | sed -e '/^[^*]/d'"))
(userstatus (if (zerop (user-uid)) ?# ?$)))
(concat
(propertize (char-to-string status)
'face `(:foreground ,(if (= status ?+)
"green"
"red")))
" "
(propertize (substring hostname 0 -1) 'face 'mode-line-buffer-id)
" "
(propertize (oni:shorten-dir dir) 'face 'font-lock-string-face)
" "
(when (not (string= branch ""))
(propertize
;; Cut off "* " and "\n"
(substring branch 2 -1)
'face 'font-lock-function-name-face))
" \n"
(propertize (char-to-string userstatus)
'face `(:foreground "blue"))
"> ")))
(defun oni:flymake-mode-func ()
"Function for `flymake-mode-hook'."
(local-set-key [M-P] 'flymake-goto-prev-error)
(local-set-key [M-N] 'flymake-goto-next-error))
(defun oni:flymake-pyflakes-init ()
"Initialize function for flymake with pyflakes."
(let* ((temp-file (flymake-init-create-temp-buffer-copy
'flymake-create-temp-inplace))
(local-file (file-relative-name temp-file (file-name-directory
buffer-file-name))))
(list "pycheck.sh" (list local-file))))
(defun oni:go-mode-func ()
"Function for `go-mode-hook'."
(setq indent-tabs-mode nil)
(local-set-key "\C-j" 'oni:newline-and-indent))
(defun oni:gtags-mode-func ()
"Function for `gtags-mode-hook'."
(local-set-key "\M-," 'gtags-find-tag)
(local-set-key "\M-." 'gtags-find-rtag))
(defun oni:html-mode-func ()
"Function for `html-mode-hook'."
(yas-minor-mode)
(fci-mode))
(defun oni:indent-shift-left (start end &optional count)
"Rigidly indent region.
Region is from START to END. Move
COUNT number of spaces if it is non-nil otherwise use
`tab-width'."
(interactive
(if mark-active
(list (region-beginning) (region-end) current-prefix-arg)
(list (line-beginning-position)
(line-end-position)
current-prefix-arg)))
(if count
(setq count (prefix-numeric-value count))
(setq count tab-width))
(when (> count 0)
(let ((deactivate-mark nil))
(save-excursion
(goto-char start)
(while (< (point) end)
(if (and (< (current-indentation) count)
(not (looking-at "[ \t]*$")))
(error "Can't shift all lines enough"))
(forward-line))
(indent-rigidly start end (- count))))))
(defun oni:indent-shift-right (start end &optional count)
"Indent region between START and END rigidly to the right.
If COUNT has been specified indent by that much, otherwise look at
`tab-width'."
(interactive
(if mark-active
(list (region-beginning) (region-end) current-prefix-arg)
(list (line-beginning-position)
(line-end-position)
current-prefix-arg)))
(let ((deactivate-mark nil))
(if count
(setq count (prefix-numeric-value count))
(setq count tab-width))
(indent-rigidly start end count)))
(defun oni:jabber-chat-mode-func ()
"Function for `jabber-chat-mode-hook'."
(visual-line-mode)
(setq mode-line-format (append (cddr jabber-chat-header-line-format)
'(global-mode-string))
header-line-format nil))
(defun oni:jabber-roster-mode-func ()
"Function for `jabber-roster-mode-hook'."
(setq mode-line-format
(list (propertize " %m" 'face 'mode-line-buffer-id))))
(defun oni:java-mode-func ()
"Function for `java-mode-hook'."
(local-set-key "\C-j" 'oni:newline-and-indent))
(defun oni:js-mode-func ()
"Function for `js-mode-hook'."
(rainbow-delimiters-mode)
(local-set-key "\C-j" 'oni:newline-and-indent)
(pretty-symbols-mode -1))
(defun oni:js2-mode-func ()
"Function for `js2-mode-hook'."
(oni:prog-mode-func)
(oni:js-mode-func)
(local-set-key (kbd "<f5>") #'slime-js-reload)
(slime-js-minor-mode))
(defun oni:kill-region-or-backward-char ()
"Either `kill-region' or `backward-delete-char-untabify'."
(interactive)
(if (region-active-p)
(kill-region (region-beginning) (region-end))
(backward-delete-char-untabify 1)))
(defun oni:kill-region-or-forward-char ()
"Either `kill-region' or `delete-forward-char'."
(interactive)
(if (region-active-p)
(kill-region (region-beginning) (region-end))
(delete-forward-char 1)))
(defun oni:kill-region-or-line ()
"Either `kill-region' or `kill-line'."
(interactive)
(if (region-active-p)
(kill-region (region-beginning) (region-end))
(kill-line)))
(defun oni:lisp-mode-func ()
"Function for `lisp-mode-hook'."
)
(defun oni:lua-mode-func()
"Function for `lisp-mode-hook'."
(local-unset-key (kbd ")"))
(local-unset-key (kbd "]"))
(local-unset-key (kbd "}")))
(defun oni:magit-log-edit-mode-func ()
"Function for `magit-log-edit-mode-hook'."
(auto-fill-mode)
(font-lock-add-keywords
nil
'(("\\`\\(.\\{,50\\}\\)\\(.*\\)\n?\\(.*\\)$"
(1 'git-commit-summary-face)
(2 'git-commit-overlong-summary-face)
(3 'git-commit-nonempty-second-line-face))
("`\\([^']+\\)'" 1 font-lock-constant-face))
t))
(defun oni:markdown-mode-func ()
"Function for `markdown-mode-hook'."
(auto-fill-mode)
(whitespace-mode))
(defun oni:message-mode-func ()
"Function for `message-mode-hook'."
(auto-fill-mode)
(flyspell-mode)
(ispell-change-dictionary (read-string "New dictionary: ")))
(defun oni:mini-fix-timestamp-string (date-string)
"A minimal version of Xah Lee's `fix-timestamp-string'.
Turn DATE-STRING into something else that can be worked with in
code. Found at http://xahlee.org/emacs/elisp_parse_time.html"
(setq date-string (replace-regexp-in-string "Jan" "01" date-string)
date-string (replace-regexp-in-string "Feb" "02" date-string)
date-string (replace-regexp-in-string "Mar" "03" date-string)
date-string (replace-regexp-in-string "Apr" "04" date-string)
date-string (replace-regexp-in-string "May" "05" date-string)
date-string (replace-regexp-in-string "Jun" "06" date-string)
date-string (replace-regexp-in-string "Jul" "07" date-string)
date-string (replace-regexp-in-string "Aug" "08" date-string)
date-string (replace-regexp-in-string "Sep" "09" date-string)
date-string (replace-regexp-in-string "Oct" "10" date-string)
date-string (replace-regexp-in-string "Nov" "11" date-string)
date-string (replace-regexp-in-string "Dec" "12" date-string))
(string-match
"^\\([0-9]\\{2\\}\\)-\\([0-9]\\{2\\}\\)-\\([0-9]\\{4\\}\\)$"
date-string)
(format "%s-%s-%s"
(match-string 3 date-string)
(match-string 2 date-string)
(match-string 1 date-string)))
(defun oni:move-beginning-of-dwim ()
"Move to beginning of line either after indentation or before."
(interactive)
(let ((start (point)))
(back-to-indentation)
(if (= start (point))
(beginning-of-line))))
(defun oni:move-end-of-dwim ()
"Move to end of line, either before any comments or after."
(interactive)
(let ((start (point))
(eolpos (line-end-position)))
(beginning-of-line)
(if (and comment-start
(comment-search-forward eolpos t))
(progn
(search-backward-regexp (concat "[^ \t" comment-start "]"))
(forward-char)
(when (or (bolp)
(= start (point)))
(end-of-line)))
(end-of-line))))
;; (defun oni:mu4e-view-mode-func ()
;; "Function for `mu4e-view-mode-hook'."
;; (longlines-mode))
(defun oni:myepisodes-formatter (plist)
"Format RSS items from MyEpisodes as org tasks.
PLIST contains all the pertinent information."
(let ((str (plist-get plist :title)))
(string-match
"^\\[ \\([^\]]+\\) \\]\\[ \\([^\]]+\\) \\]\\[ \\([^\]]+\\) \\]\\[ \\([^\]]+\\) \\]$"
str)
(let* ((title (match-string 1 str))
(episode (match-string 2 str))
(name (match-string 3 str))
(date (oni:mini-fix-timestamp-string (match-string 4 str))))
(format "* ACQUIRE %s %s - %s <%s>" title episode name date))))
(defun oni:newline-and-indent ()
"`newline-and-indent', but with a twist.
When dealing with braces, add another line and indent that too."
(interactive)
(if (and (not (or (= (point) (point-max))
(= (point) (point-min))))
(or (and (char-equal (char-before) ?{)
(char-equal (char-after) ?}))
(and (char-equal (char-before) ?\()
(char-equal (char-after) ?\)))))
(save-excursion (newline-and-indent)))
(newline-and-indent))
(defun oni:org-mode-func ()
"Function for `org-mode-hook'."
(flyspell-mode)
(auto-fill-mode)
(yas-minor-mode))
(defun oni:php-mode-func ()
"Function for `php-mode-hook'."
(flymake-mode)
(local-set-key "\C-j" 'oni:newline-and-indent)
(c-set-offset 'arglist-intro '+)
(c-set-offset 'arglist-close '0)
(rainbow-delimiters-mode)
(setq fci-rule-column 80))
(defun oni:prog-mode-func ()
"Function for `prog-mode-hook'."
(rainbow-delimiters-mode)
(fci-mode)
(pretty-symbols-mode)
(yas-minor-mode))
(defun oni:python-mode-func ()
"Function for `python-mode-hook'."
(flymake-mode)
(local-set-key (kbd "C->") 'python-indent-shift-right)
(local-set-key (kbd "C-<") 'python-indent-shift-left)
(set (make-local-variable 'electric-indent-chars) nil)
(rainbow-delimiters-mode)
(setq fci-rule-column 79
fill-column 72)
(fci-mode))
(defun oni:raise-eshell ()
"Start or switch back to `eshell'.
Also change directories to current working directory."
(interactive)
(let ((dir (file-name-directory
(or (buffer-file-name) "~/")))
(hasfile (not (eq (buffer-file-name) nil))))
(eshell)
(if (and hasfile (eq eshell-process-list nil))
(progn
(eshell/cd dir)
(eshell-reset)))))
(defun oni:raise-scratch (&optional mode)
"Show the *scratch* buffer.
If called with a universal argument, ask the user which mode to
use. If MODE is not nil, open a new buffer with the name
*MODE-scratch* and load MODE as its major mode."
(interactive (list (if current-prefix-arg
(read-string "Mode: ")
nil)))
(let* ((bname (if mode
(concat "*" mode "-scratch*")
"*scratch*"))
(buffer (get-buffer bname))
(mode-sym (intern (concat mode "-mode"))))
(unless buffer
(setq buffer (generate-new-buffer bname))
(with-current-buffer buffer
(when (fboundp mode-sym)
(funcall mode-sym))))
(select-window (display-buffer buffer))))
(defun oni:reload-buffer ()
"Reload current buffer."
(interactive)
(revert-buffer nil t nil))
(defun oni:replace-html-special-chars ()
"Replace special characters with HTML escaped entities."
(oni:replace-occurrences "é" "&eacute;"))
(defun oni:replace-occurrences (from to)
"Replace all occurrences of FROM with TO in the current buffer."
(save-excursion
(goto-char (point-min))
(while (search-forward from nil t)
(replace-match to))))
(defun oni:required-packages-installed-p ()
"Check if all the packages I need are installed."
(let ((tmp-packages oni:required-packages)
(result t))
(while (and tmp-packages result)
(if (not (package-installed-p (car tmp-packages)))
(setq result nil))
(setq tmp-packages (cdr tmp-packages)))
result))
(defun oni:scheme-mode-func ()
"Function for `scheme-mode-hook'."
)
(defun oni:self-insert-dwim ()
"Execute self insert, but when the region is active call self
insert at the end of the region and at the beginning."
(interactive)
(if (region-active-p)
(let ((electric-pair-mode nil)
(beginning (region-beginning))
(end (region-end)))
(goto-char end)
(self-insert-command 1)
(save-excursion
(goto-char beginning)
(self-insert-command 1)))
(self-insert-command 1)))
(defun oni:shorten-dir (dir)
"Shorten a directory, (almost) like fish does it."
(while (string-match "\\(/\\.?[^./]\\)[^/]+/" dir)
(setq dir (replace-match "\\1/" nil nil dir)))
dir)
(defun oni:split-window-interactive (dir)
"Split windows in direction DIR.
Can also delete or switch to another window."
(interactive
(list (read-char "Direction (h,v,q,d,o): ")))
(case dir
((?v) (split-window-vertically))
((?h) (split-window-horizontally))
((?q) (delete-other-windows))
((?d) (delete-window))
((?o) (other-window 1))))
(defun oni:split-window-interactively (window)
"Ask for a direction and split WINDOW that way.
If no direction is given, don't split."
(let ((dir (read-char "Direction (h,v): ")))
(case dir
((?v) (split-window-vertically))
((?h) (split-window-horizontally))
(t window))))
(defun oni:start-emms ()
"Check to see if the function `emms' exists, if not call
`emms-player-mpd-connect' and assume that will have loaded it."
(interactive)
(unless (fboundp 'emms)
(emms-player-mpd-connect))
(emms))
(defun oni:term-mode-func ()
"Function for `term-mode-hook'."
(setq truncate-lines nil))
(defun oni:texinfo-mode-func ()
"Function for `texinfo-mode-hook'."
(auto-fill-mode))
(defun oni:view-mail (inbox)
"Show a menu with all mailbox options from `oni:mailbox-map'
for easy selection."
(interactive
(list (progn
(require 'tmm)
(let ((tmm-completion-prompt "Choose a mailbox\n"))
(tmm-prompt oni:mailbox-map)))))
(if inbox
(progn
(require 'mu4e)
(funcall (intern (concat "oni:" inbox "-mailbox")))
(mu4e))))
(defun oni:write-file-func ()
"Function for `write-file-hooks'."
(time-stamp))
(defun oni:yas-minor-mode-func ()
"Function for `yas-minor-mode-hook'."
(yas-load-directory (car yas-snippet-dirs)))
(eval-after-load "ebuff-menu" (eval-after-load "ebuff-menu"
'(define-key electric-buffer-menu-mode-map '(define-key electric-buffer-menu-mode-map
(kbd "C-s") 'isearch-forward)) (kbd "C-s") 'isearch-forward))
@ -659,7 +73,7 @@ for easy selection."
(add-to-list ; Make sure pyflakes is loaded (add-to-list ; Make sure pyflakes is loaded
'flymake-allowed-file-name-masks ; for python files. 'flymake-allowed-file-name-masks ; for python files.
'("\\.py\\'" oni:flymake-pyflakes-init)) '("\\.py\\'" ext:flymake-pyflakes-init))
(add-to-list ; Error line repexp for go (add-to-list ; Error line repexp for go
'flymake-err-line-patterns ; compilation. 'flymake-err-line-patterns ; compilation.
@ -677,15 +91,6 @@ for easy selection."
(eval-after-load "info" (eval-after-load "info"
'(require 'info+)) '(require 'info+))
(eval-after-load "mu4e"
'(add-to-list
'org-capture-templates
'("c" "Contact" entry (file "~/documents/org/misc/contacts.org")
(concat "* %(mu4e-view-snarf-from 'name)\n"
" :PROPERTIES:\n"
" :EMAIL: %(mu4e-view-snarf-from 'email)\n"
" :END:"))))
(eval-after-load "org" (eval-after-load "org"
'(progn '(progn
(require 'appt) (require 'appt)
@ -731,53 +136,6 @@ for easy selection."
(setq-default fci-rule-column 73) (setq-default fci-rule-column 73)
(setq-default gac-automatically-push-p t) (setq-default gac-automatically-push-p t)
(setq-default indent-tabs-mode nil) (setq-default indent-tabs-mode nil)
;; (setq-default mode-line-format
;; (list
;; '(:eval
;; (if (and (buffer-modified-p) (buffer-file-name))
;; (propertize "!"
;; 'face 'oni:mode-line-modified
;; 'help-echo "Buffer has been modified")
;; " "))
;; '(:eval (propertize "%m"
;; 'face 'oni:mode-line-mode
;; 'help-echo buffer-file-coding-system))
;; ": "
;; '(:eval (propertize "%b "
;; 'face 'mode-line-buffer-id
;; 'help-echo (buffer-file-name)))
;; "("
;; (propertize "%p" 'face 'oni:mode-line-buffer-position) ":"
;; (propertize "%04l" 'face 'oni:mode-line-buffer-line) ","
;; (propertize "%02c" 'face 'oni:mode-line-buffer-column)
;; ") "
;; "["
;; '(:eval (propertize
;; (if buffer-read-only
;; "R"
;; (if overwrite-mode "O" "I"))
;; 'face 'oni:mode-line-buffer-state
;; 'help-echo (concat "Buffer is "
;; (if buffer-read-only
;; "read-only"
;; (if overwrite-mode
;; "in overwrite mode"
;; "in insert mode")))))
;; "] "
;; '(:eval
;; (propertize (format-time-string "%H:%M")
;; 'help-echo
;; (concat (format-time-string "%c; ")
;; (emacs-uptime "Uptime: %hh"))))
;; " --"
;; '(:eval global-mode-string)))
(setq-default php-mode-warn-if-mumamo-off nil) (setq-default php-mode-warn-if-mumamo-off nil)
(setq-default require-final-newline t) (setq-default require-final-newline t)
(setq-default tab-width 4) (setq-default tab-width 4)
@ -847,8 +205,8 @@ for easy selection."
(setq jabber-chat-buffer-format "*jabber:%n*") (setq jabber-chat-buffer-format "*jabber:%n*")
(setq jabber-chat-buffer-show-avatar nil) (setq jabber-chat-buffer-show-avatar nil)
(setq jabber-chat-fill-long-lines nil) (setq jabber-chat-fill-long-lines nil)
(setq jabber-chat-foreign-prompt-format "[%t] < ") (setq jabber-chat-foreign-prompt-format "%t < ")
(setq jabber-chat-local-prompt-format "[%t] > ") (setq jabber-chat-local-prompt-format "%t > ")
(setq jabber-chatstates-confirm nil) (setq jabber-chatstates-confirm nil)
(setq jabber-history-dir "~/.emacs.d/jabber") (setq jabber-history-dir "~/.emacs.d/jabber")
(setq jabber-roster-show-bindings nil) (setq jabber-roster-show-bindings nil)
@ -922,16 +280,16 @@ for easy selection."
(setq org-src-fontify-natively t) (setq org-src-fontify-natively t)
(setq org-tags-exclude-from-inheritance '("crypt")) (setq org-tags-exclude-from-inheritance '("crypt"))
(setq org-todo-keyword-faces (setq org-todo-keyword-faces
'(("TODO" :foreground "red") '(("TODO" :background "red")
("IN PROGRESS" :foreground "yellow") ("DONE" :background "forest green")
("DONE" :foreground "forest green") ("SUCCEEDED" :background "forest green")
("SUCCEEDED" :foreground "forest green") ("WAITING" :background "orange" :foreground "black")
("WAITING" :foreground "orange") ("CANCELLED" :background "orange red")
("CANCELLED" :foreground "orangered") ("FAILED" :background "orange red")
("FAILED" :foreground "orangered"))) ("WIP" :background "#ff9800" :foreground "black")
(setq org-todo-keywords ("HOLD" :background "orange" :foreground "black")
'((sequence "TODO(t)" "IN PROGRESS" "WAITING(@/!)" "|" ("ACQUIRE" :background "red")
"DONE(!/!)" "CANCELLED(@/!)"))) ("IGNORED" :background "#555555")))
(setq org-use-fast-todo-selection t) (setq org-use-fast-todo-selection t)
(setq package-archives (setq package-archives
'(("melpa" . "http://melpa.milkbox.net/packages/") '(("melpa" . "http://melpa.milkbox.net/packages/")
@ -974,7 +332,6 @@ for easy selection."
(add-hook 'after-save-hook 'oni:after-save-func t) (add-hook 'after-save-hook 'oni:after-save-func t)
(add-hook 'before-save-hook 'oni:before-save-func) (add-hook 'before-save-hook 'oni:before-save-func)
(add-hook 'c-mode-common-hook 'oni:c-mode-common-func)
(add-hook 'c-mode-hook 'oni:c-mode-func) (add-hook 'c-mode-hook 'oni:c-mode-func)
(add-hook 'css-mode-hook 'oni:css-mode-func) (add-hook 'css-mode-hook 'oni:css-mode-func)
(add-hook 'diary-display-hook 'oni:diary-display-func) (add-hook 'diary-display-hook 'oni:diary-display-func)
@ -990,17 +347,15 @@ for easy selection."
(add-hook 'java-mode-hook 'oni:java-mode-func) (add-hook 'java-mode-hook 'oni:java-mode-func)
(add-hook 'js-mode-hook 'oni:js-mode-func) (add-hook 'js-mode-hook 'oni:js-mode-func)
(add-hook 'js2-mode-hook 'oni:js2-mode-func) (add-hook 'js2-mode-hook 'oni:js2-mode-func)
(add-hook 'lisp-mode-hook 'oni:lisp-mode-func)
(add-hook 'lua-mode-hook 'oni:lua-mode-func) (add-hook 'lua-mode-hook 'oni:lua-mode-func)
(add-hook 'magit-log-edit-mode-hook 'oni:magit-log-edit-mode-func) (add-hook 'magit-log-edit-mode-hook 'oni:magit-log-edit-mode-func)
(add-hook 'markdown-mode-hook 'oni:markdown-mode-func) (add-hook 'markdown-mode-hook 'oni:markdown-mode-func)
(add-hook 'message-mode-hook 'oni:message-mode-func) (add-hook 'message-mode-hook 'oni:message-mode-func)
;; (add-hook 'mu4e-view-mode-hook 'oni:mu4e-view-mode-func)
(add-hook 'org-mode-hook 'oni:org-mode-func) (add-hook 'org-mode-hook 'oni:org-mode-func)
(add-hook 'php-mode-hook 'oni:php-mode-func) (add-hook 'php-mode-hook 'oni:php-mode-func)
(add-hook 'prog-mode-hook 'oni:prog-mode-func) (add-hook 'prog-mode-hook 'oni:prog-mode-func)
(add-hook 'python-mode-hook 'oni:python-mode-func) (add-hook 'python-mode-hook 'oni:python-mode-func)
(add-hook 'scheme-mode-hook 'oni:scheme-mode-func) (add-hook 'rst-mode-hook 'oni:rst-mode-func)
(add-hook 'term-mode-hook 'oni:term-mode-func) (add-hook 'term-mode-hook 'oni:term-mode-func)
(add-hook 'texinfo-mode-hook 'oni:texinfo-mode-func) (add-hook 'texinfo-mode-hook 'oni:texinfo-mode-func)
(add-hook 'write-file-hooks 'oni:write-file-func) (add-hook 'write-file-hooks 'oni:write-file-func)
@ -1014,12 +369,13 @@ for easy selection."
(global-set-key (kbd "<XF86HomePage>") 'oni:raise-scratch) (global-set-key (kbd "<XF86HomePage>") 'oni:raise-scratch)
(global-set-key (kbd "<XF86Mail>") 'oni:view-mail) (global-set-key (kbd "<XF86Mail>") 'oni:view-mail)
(global-set-key (kbd "<XF86Tools>") 'oni:start-emms) (global-set-key (kbd "<XF86Tools>") 'oni:start-emms)
(global-set-key (kbd "<f5>") 'oni:reload-buffer) (global-set-key (kbd "<f5>") 'ext:reload-buffer)
(global-set-key (kbd "<f6>") 'jabber-switch-to-roster-buffer) (global-set-key (kbd "<f6>") 'jabber-switch-to-roster-buffer)
(global-set-key (kbd "<f7>") 'magit-status) (global-set-key (kbd "<f7>") 'magit-status)
(global-set-key (kbd "<f8>") 'oni:raise-eshell) (global-set-key (kbd "<f8>") 'oni:raise-eshell)
(global-set-key (kbd "C-<") 'indent-shift-left) (global-set-key (kbd "C-<") 'indent-shift-left)
(global-set-key (kbd "C->") 'indent-shift-right) (global-set-key (kbd "C->") 'indent-shift-right)
(global-set-key (kbd "C-M-4") 'split-window-vertically)
(global-set-key (kbd "C-M-SPC") 'er/expand-region) (global-set-key (kbd "C-M-SPC") 'er/expand-region)
(global-set-key (kbd "C-M-d") 'kill-word) (global-set-key (kbd "C-M-d") 'kill-word)
(global-set-key (kbd "C-M-w") 'backward-kill-word) (global-set-key (kbd "C-M-w") 'backward-kill-word)
@ -1028,15 +384,15 @@ for easy selection."
(global-set-key (kbd "C-c a") 'org-agenda) (global-set-key (kbd "C-c a") 'org-agenda)
(global-set-key (kbd "C-c c") 'org-capture) (global-set-key (kbd "C-c c") 'org-capture)
(global-set-key (kbd "C-c i p") 'identica-update-status-interactive) (global-set-key (kbd "C-c i p") 'identica-update-status-interactive)
(global-set-key (kbd "C-c p") 'oni:show-buffer-position)
(global-set-key (kbd "C-d") 'oni:kill-region-or-forward-char) (global-set-key (kbd "C-d") 'oni:kill-region-or-forward-char)
(global-set-key (kbd "C-e") 'oni:move-end-of-dwim) (global-set-key (kbd "C-e") 'oni:move-end-of-dwim)
(global-set-key (kbd "C-k") 'oni:kill-region-or-line) (global-set-key (kbd "C-k") 'oni:kill-region-or-line)
(global-set-key (kbd "C-w") 'oni:kill-region-or-backward-char) (global-set-key (kbd "C-w") 'oni:kill-region-or-backward-char)
(global-set-key (kbd "C-x C-b") 'electric-buffer-list) (global-set-key (kbd "C-x C-b") 'electric-buffer-list)
(global-set-key (kbd "M-4") 'split-window-horizontally)
(global-set-key (kbd "M-n") 'idomenu) (global-set-key (kbd "M-n") 'idomenu)
(global-set-key (kbd "\"") 'oni:self-insert-dwim) (global-set-key (kbd "\"") 'oni:self-insert-dwim)
(global-set-key (kbd "M-4") 'split-window-horizontally)
(global-set-key (kbd "C-M-4") 'split-window-vertically)
(if (daemonp) (if (daemonp)
(global-set-key "\C-x\C-c" 'oni:close-client-window) (global-set-key "\C-x\C-c" 'oni:close-client-window)
@ -1064,9 +420,10 @@ for easy selection."
'(".*" . ((bw-display-in-other-window . nil)))) '(".*" . ((bw-display-in-other-window . nil))))
(add-to-list 'display-buffer-alist (add-to-list 'display-buffer-alist
'("^\\*.*\\*$" . ((bw-display-in-bottom-window . nil)))) '("^\\*.*\\*$" . ((bw-display-in-bottom-window . nil))))
(add-to-list 'display-buffer-alist
'("^\\*magit: .*\\*$" . ((display-buffer-same-window . nil))))
(delete " " mode-line-format) (delete " " mode-line-format)
(delete " " mode-line-format)
(unless (oni:required-packages-installed-p) (unless (oni:required-packages-installed-p)
(message "%s" "Refreshing package database...") (message "%s" "Refreshing package database...")

47
.emacs.d/site-lisp/ext.el Normal file
View file

@ -0,0 +1,47 @@
;;; ext.el --- More emacs functions
;; Copyright (C) 2012 Tom Willemsen
;; Author: Tom Willemsen <tom@ryuslash.org>
;; Keywords: local
;; 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.
;; 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.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;
;;; Code:
(defadvice org-agenda-redo (after ext:org-agenda-redo-add-appts)
"Pressing `r' on the agenda will also add appointments."
(progn
(setq appt-time-msg-list nil)
(org-agenda-to-appt)))
(defun ext:flymake-pyflakes-init ()
"Initialize function for flymake with pyflakes."
(let* ((temp-file (flymake-init-create-temp-buffer-copy
'flymake-create-temp-inplace))
(local-file (file-relative-name temp-file (file-name-directory
buffer-file-name))))
(list "pycheck.sh" (list local-file))))
(defun ext:reload-buffer ()
"Reload current buffer."
(interactive)
(revert-buffer nil t nil))
(provide 'ext)
;;; ext.el ends here

View file

@ -0,0 +1,59 @@
;;; mode-icons.el --- Show icons for modes
;; Copyright (C) 2012 Tom Willemsen
;; Author: Tom Willemsen <thomas@aethon.nl>
;; Keywords: multimedia
;; 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.
;; 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.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;
;;; Code:
(defun mode-icons-get-icon-file (name)
(concat user-emacs-directory "/icons/" name))
(defvar mode-icons
`(("Emacs-Lisp" . (image :type xpm
:file ,(mode-icons-get-icon-file "emacs.xpm")
:ascent center))
("Python" . (image :type xpm
:file ,(mode-icons-get-icon-file "python.xpm")
:ascent center))
("Scheme" . (image :type xpm
:file ,(mode-icons-get-icon-file "scheme.xpm")
:ascent center))
("Lisp" . (image :type xpm
:file ,(mode-icons-get-icon-file "cl.xpm")
:ascent center))
("PHP" . (image :type xpm
:file ,(mode-icons-get-icon-file "php.xpm")
:ascent center)))
"Icons for major modes.")
(defun set-mode-icon (mode)
(let ((icon-spec (assoc mode mode-icons)))
(if icon-spec
(setq mode-name (propertize mode-name 'display (cdr icon-spec))))))
(defun set-current-mode-icon ()
(set-mode-icon mode-name))
(add-hook 'after-change-major-mode-hook 'set-current-mode-icon)
(provide 'mode-icons)
;;; mode-icons.el ends here

555
.emacs.d/site-lisp/oni.el Normal file
View file

@ -0,0 +1,555 @@
;;; oni.el --- Functions for emacs
;; Copyright (C) 2012 Tom Willemsen
;; Author: Tom Willemsen <tom@ryuslash.org>
;; Keywords: local
;; 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.
;; 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.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;
;;; Code:
(defmacro oni:define-mailbox (name email &optional signature longname)
"Define a mailbox function for mailbox NAME with address EMAIL.
Optionally set signature to SIGNATURE and use LONGNAME as the
actual account name."
`(defun ,(make-symbol (concat "oni:" name "-mailbox")) ()
,(concat "Settings for " name " mailbox")
(setq mu4e-mu-home ,(expand-file-name (concat "~/.mu/" name))
mu4e-maildir ,(expand-file-name (concat "~/documents/mail/"
(or longname name)))
mu4e-get-mail-command ,(concat "offlineimap -oa " (or longname
name))
mu4e~main-buffer-name ,(concat "*mu4e-" name "*")
user-mail-address ,email
message-sendmail-extra-arguments '("-a" ,name)
message-signature-file ,signature)))
(defmacro oni:email (user at host dot com)
"Turn arguments into an email address.
The resulting email address will look like: USER@HOST.COM, AT and
DOT are intentionally being skipped."
(concat (symbol-name user) "@" (symbol-name host) "."
(symbol-name com)))
(defvar oni:mailbox-map
'("top" ("menu"
("ryulash.org" . "ryuslash")
("ninthfloor" . "ninthfloor")
("gmail" . "gmail")
("aethon" . "aethon")))
"A mailbox map for use with `tmm-prompt'.")
(defvar oni:required-packages
'(graphviz-dot-mode htmlize magit rainbow-delimiters
rainbow-mode yasnippet markdown-mode flymake
flymake-cursor pony-mode sauron dispass
expand-region fill-column-indicator
git-auto-commit-mode idomenu magit smex)
"List of all the packages I have (want) installed.")
(defun oni:after-save-func ()
"Function for `after-save-hook'."
(oni:compile-el)
(executable-make-buffer-file-executable-if-script-p)
(let ((dom-dir (locate-dominating-file (buffer-file-name) "Makefile")))
(when dom-dir
(shell-command (concat "make -C " dom-dir " TAGS >/dev/null 2>&1")))))
(defun oni:before-save-func ()
"Function for `before-save-hook'."
(if (eq major-mode 'html-mode)
(oni:replace-html-special-chars))
(if (not (eq major-mode 'markdown-mode))
(delete-trailing-whitespace)))
(defun oni:c-mode-func ()
"Function for `c-mode-hook'."
(local-set-key [f9] 'compile)
(local-set-key "\C-j" 'oni:newline-and-indent))
(defun oni:close-client-window ()
"Close a client's frames."
(interactive)
(server-save-buffers-kill-terminal nil))
(defun oni:compile-el ()
"Compile the current buffer file if it is an .el file."
(let* ((full-file-name (buffer-file-name))
(file-name (file-name-nondirectory full-file-name))
(suffix (file-name-extension file-name)))
(if (and (not (string-equal file-name ".dir-locals.el"))
(string-equal suffix "el"))
(byte-compile-file full-file-name))))
(defun oni:css-mode-func ()
"Function for `css-mode-hook'."
(local-set-key "\C-j" 'oni:newline-and-indent)
(rainbow-mode))
(defun oni:diary-display-func ()
"Function for `diary-display-hook'."
(diary-fancy-display))
(defun oni:emacs-lisp-mode-func ()
"Function for `emacs-lisp-mode-hook'."
(eldoc-mode))
(defun oni:emms-toggle-playing ()
"Toggle between playing/paused states."
(interactive)
(if (eq emms-player-playing-p nil)
(emms-start)
(emms-pause)))
(defun oni:erc-mode-func ()
"Function for `erc-mode-hook'."
(erc-fill-mode -1)
(visual-line-mode)
(setq truncate-lines nil))
(defun oni:eshell-mode-func ()
"Function for `eshell-mode-hook'."
(setq truncate-lines nil))
(defun oni:eshell-prompt-function ()
"Show a pretty shell prompt."
(let ((status (if (zerop eshell-last-command-status) ?+ ?-))
(hostname (shell-command-to-string "hostname"))
(dir (abbreviate-file-name (eshell/pwd)))
(branch
(shell-command-to-string
"git branch --contains HEAD 2>/dev/null | sed -e '/^[^*]/d'"))
(userstatus (if (zerop (user-uid)) ?# ?$)))
(concat
(propertize (char-to-string status)
'face `(:foreground ,(if (= status ?+)
"green"
"red")))
" "
(propertize (substring hostname 0 -1) 'face 'mode-line-buffer-id)
" "
(propertize (oni:shorten-dir dir) 'face 'font-lock-string-face)
" "
(when (not (string= branch ""))
(propertize
;; Cut off "* " and "\n"
(substring branch 2 -1)
'face 'font-lock-function-name-face))
" \n"
(propertize (char-to-string userstatus)
'face `(:foreground "blue"))
"> ")))
(defun oni:flymake-mode-func ()
"Function for `flymake-mode-hook'."
(local-set-key [M-P] 'flymake-goto-prev-error)
(local-set-key [M-N] 'flymake-goto-next-error))
(defun oni:go-mode-func ()
"Function for `go-mode-hook'."
(setq indent-tabs-mode nil)
(local-set-key "\C-j" 'oni:newline-and-indent))
(defun oni:gtags-mode-func ()
"Function for `gtags-mode-hook'."
(local-set-key "\M-," 'gtags-find-tag)
(local-set-key "\M-." 'gtags-find-rtag))
(defun oni:html-mode-func ()
"Function for `html-mode-hook'."
(yas-minor-mode)
(fci-mode))
(defun oni:indent-shift-left (start end &optional count)
"Rigidly indent region.
Region is from START to END. Move
COUNT number of spaces if it is non-nil otherwise use
`tab-width'."
(interactive
(if mark-active
(list (region-beginning) (region-end) current-prefix-arg)
(list (line-beginning-position)
(line-end-position)
current-prefix-arg)))
(if count
(setq count (prefix-numeric-value count))
(setq count tab-width))
(when (> count 0)
(let ((deactivate-mark nil))
(save-excursion
(goto-char start)
(while (< (point) end)
(if (and (< (current-indentation) count)
(not (looking-at "[ \t]*$")))
(error "Can't shift all lines enough"))
(forward-line))
(indent-rigidly start end (- count))))))
(defun oni:indent-shift-right (start end &optional count)
"Indent region between START and END rigidly to the right.
If COUNT has been specified indent by that much, otherwise look at
`tab-width'."
(interactive
(if mark-active
(list (region-beginning) (region-end) current-prefix-arg)
(list (line-beginning-position)
(line-end-position)
current-prefix-arg)))
(let ((deactivate-mark nil))
(if count
(setq count (prefix-numeric-value count))
(setq count tab-width))
(indent-rigidly start end count)))
(defun oni:jabber-chat-mode-func ()
"Function for `jabber-chat-mode-hook'."
(visual-line-mode)
(setq mode-line-format (append (cddr jabber-chat-header-line-format)
'(global-mode-string))
header-line-format nil))
(defun oni:jabber-roster-mode-func ()
"Function for `jabber-roster-mode-hook'."
(setq mode-line-format
(list (propertize " %m" 'face 'mode-line-buffer-id))))
(defun oni:java-mode-func ()
"Function for `java-mode-hook'."
(local-set-key "\C-j" 'oni:newline-and-indent))
(defun oni:js-mode-func ()
"Function for `js-mode-hook'."
(rainbow-delimiters-mode)
(local-set-key "\C-j" 'oni:newline-and-indent)
(pretty-symbols-mode -1))
(defun oni:js2-mode-func ()
"Function for `js2-mode-hook'."
(oni:prog-mode-func)
(oni:js-mode-func)
(local-set-key (kbd "<f5>") #'slime-js-reload)
(slime-js-minor-mode))
(defun oni:kill-region-or-backward-char ()
"Either `kill-region' or `backward-delete-char-untabify'."
(interactive)
(if (region-active-p)
(kill-region (region-beginning) (region-end))
(backward-delete-char-untabify 1)))
(defun oni:kill-region-or-forward-char ()
"Either `kill-region' or `delete-forward-char'."
(interactive)
(if (region-active-p)
(kill-region (region-beginning) (region-end))
(delete-forward-char 1)))
(defun oni:kill-region-or-line ()
"Either `kill-region' or `kill-line'."
(interactive)
(if (region-active-p)
(kill-region (region-beginning) (region-end))
(kill-line)))
(defun oni:lua-mode-func()
"Function for `lua-mode-hook'."
(local-unset-key (kbd ")"))
(local-unset-key (kbd "]"))
(local-unset-key (kbd "}")))
(defun oni:magit-log-edit-mode-func ()
"Function for `magit-log-edit-mode-hook'."
(auto-fill-mode)
(font-lock-add-keywords
nil
'(("\\`\\(.\\{,50\\}\\)\\(.*\\)\n?\\(.*\\)$"
(1 'git-commit-summary-face)
(2 'git-commit-overlong-summary-face)
(3 'git-commit-nonempty-second-line-face))
("`\\([^']+\\)'" 1 font-lock-constant-face))
t))
(defun oni:markdown-mode-func ()
"Function for `markdown-mode-hook'."
(auto-fill-mode)
(whitespace-mode))
(defun oni:message-mode-func ()
"Function for `message-mode-hook'."
(auto-fill-mode)
(flyspell-mode)
(ispell-change-dictionary (read-string "New dictionary: ")))
(defun oni:mini-fix-timestamp-string (date-string)
"A minimal version of Xah Lee's `fix-timestamp-string'.
Turn DATE-STRING into something else that can be worked with in
code. Found at http://xahlee.org/emacs/elisp_parse_time.html"
(setq date-string (replace-regexp-in-string "Jan" "01" date-string)
date-string (replace-regexp-in-string "Feb" "02" date-string)
date-string (replace-regexp-in-string "Mar" "03" date-string)
date-string (replace-regexp-in-string "Apr" "04" date-string)
date-string (replace-regexp-in-string "May" "05" date-string)
date-string (replace-regexp-in-string "Jun" "06" date-string)
date-string (replace-regexp-in-string "Jul" "07" date-string)
date-string (replace-regexp-in-string "Aug" "08" date-string)
date-string (replace-regexp-in-string "Sep" "09" date-string)
date-string (replace-regexp-in-string "Oct" "10" date-string)
date-string (replace-regexp-in-string "Nov" "11" date-string)
date-string (replace-regexp-in-string "Dec" "12" date-string))
(string-match
"^\\([0-9]\\{2\\}\\)-\\([0-9]\\{2\\}\\)-\\([0-9]\\{4\\}\\)$"
date-string)
(format "%s-%s-%s"
(match-string 3 date-string)
(match-string 2 date-string)
(match-string 1 date-string)))
(defun oni:move-beginning-of-dwim ()
"Move to beginning of line either after indentation or before."
(interactive)
(let ((start (point)))
(back-to-indentation)
(if (= start (point))
(beginning-of-line))))
(defun oni:move-end-of-dwim ()
"Move to end of line, either before any comments or after."
(interactive)
(let ((start (point))
(eolpos (line-end-position)))
(beginning-of-line)
(if (and comment-start
(comment-search-forward eolpos t))
(progn
(search-backward-regexp (concat "[^ \t" comment-start "]"))
(forward-char)
(when (or (bolp)
(= start (point)))
(end-of-line)))
(end-of-line))))
(defun oni:myepisodes-formatter (plist)
"Format RSS items from MyEpisodes as org tasks.
PLIST contains all the pertinent information."
(let ((str (plist-get plist :title)))
(string-match
"^\\[ \\([^\]]+\\) \\]\\[ \\([^\]]+\\) \\]\\[ \\([^\]]+\\) \\]\\[ \\([^\]]+\\) \\]$"
str)
(let* ((title (match-string 1 str))
(episode (match-string 2 str))
(name (match-string 3 str))
(date (oni:mini-fix-timestamp-string (match-string 4 str))))
(format "* ACQUIRE %s %s - %s <%s>" title episode name date))))
(defun oni:newline-and-indent ()
"`newline-and-indent', but with a twist.
When dealing with braces, add another line and indent that too."
(interactive)
(if (and (not (or (= (point) (point-max))
(= (point) (point-min))))
(or (and (char-equal (char-before) ?{)
(char-equal (char-after) ?}))
(and (char-equal (char-before) ?\()
(char-equal (char-after) ?\)))))
(save-excursion (newline-and-indent)))
(newline-and-indent))
(defun oni:org-mode-func ()
"Function for `org-mode-hook'."
(flyspell-mode)
(auto-fill-mode)
(yas-minor-mode))
(defun oni:php-mode-func ()
"Function for `php-mode-hook'."
(flymake-mode)
(local-set-key "\C-j" 'oni:newline-and-indent)
(c-set-offset 'arglist-intro '+)
(c-set-offset 'arglist-close '0)
(rainbow-delimiters-mode)
(setq fci-rule-column 80))
(defun oni:prog-mode-func ()
"Function for `prog-mode-hook'."
(rainbow-delimiters-mode)
(fci-mode)
(pretty-symbols-mode)
(yas-minor-mode))
(defun oni:python-mode-func ()
"Function for `python-mode-hook'."
(flymake-mode)
(local-set-key (kbd "C->") 'python-indent-shift-right)
(local-set-key (kbd "C-<") 'python-indent-shift-left)
(set (make-local-variable 'electric-indent-chars) nil)
(rainbow-delimiters-mode)
(setq fci-rule-column 79
fill-column 72)
(fci-mode))
(defun oni:raise-eshell ()
"Start or switch back to `eshell'.
Also change directories to current working directory."
(interactive)
(let ((dir (file-name-directory
(or (buffer-file-name) "~/")))
(hasfile (not (eq (buffer-file-name) nil))))
(eshell)
(if (and hasfile (eq eshell-process-list nil))
(progn
(eshell/cd dir)
(eshell-reset)))))
(defun oni:raise-scratch (&optional mode)
"Show the *scratch* buffer.
If called with a universal argument, ask the user which mode to
use. If MODE is not nil, open a new buffer with the name
*MODE-scratch* and load MODE as its major mode."
(interactive (list (if current-prefix-arg
(read-string "Mode: ")
nil)))
(let* ((bname (if mode
(concat "*" mode "-scratch*")
"*scratch*"))
(buffer (get-buffer bname))
(mode-sym (intern (concat mode "-mode"))))
(unless buffer
(setq buffer (generate-new-buffer bname))
(with-current-buffer buffer
(when (fboundp mode-sym)
(funcall mode-sym))))
(select-window (display-buffer buffer))))
(defun oni:replace-html-special-chars ()
"Replace special characters with HTML escaped entities."
(oni:replace-occurrences "é" "&eacute;"))
(defun oni:replace-occurrences (from to)
"Replace all occurrences of FROM with TO in the current buffer."
(save-excursion
(goto-char (point-min))
(while (search-forward from nil t)
(replace-match to))))
(defun oni:required-packages-installed-p ()
"Check if all the packages I need are installed."
(let ((tmp-packages oni:required-packages)
(result t))
(while (and tmp-packages result)
(if (not (package-installed-p (car tmp-packages)))
(setq result nil))
(setq tmp-packages (cdr tmp-packages)))
result))
(defun oni:rst-mode-func ()
"Function for `rst-mode-hook'."
(auto-fill-mode))
(defun oni:self-insert-dwim ()
"Execute self insert, but when the region is active call self
insert at the end of the region and at the beginning."
(interactive)
(if (region-active-p)
(let ((electric-pair-mode nil)
(beginning (region-beginning))
(end (region-end)))
(goto-char end)
(self-insert-command 1)
(save-excursion
(goto-char beginning)
(self-insert-command 1)))
(self-insert-command 1)))
(defun oni:shorten-dir (dir)
"Shorten a directory, (almost) like fish does it."
(while (string-match "\\(/\\.?[^./]\\)[^/]+/" dir)
(setq dir (replace-match "\\1/" nil nil dir)))
dir)
(defun oni:show-buffer-position ()
"Show the position in the current buffer."
(interactive)
(message (format "%d:%d" (line-number-at-pos) (current-column))))
(defun oni:split-window-interactive (dir)
"Split windows in direction DIR.
Can also delete or switch to another window."
(interactive
(list (read-char "Direction (h,v,q,d,o): ")))
(case dir
((?v) (split-window-vertically))
((?h) (split-window-horizontally))
((?q) (delete-other-windows))
((?d) (delete-window))
((?o) (other-window 1))))
(defun oni:split-window-interactively (window)
"Ask for a direction and split WINDOW that way.
If no direction is given, don't split."
(let ((dir (read-char "Direction (h,v): ")))
(case dir
((?v) (split-window-vertically))
((?h) (split-window-horizontally))
(t window))))
(defun oni:start-emms ()
"Check to see if the function `emms' exists, if not call
`emms-player-mpd-connect' and assume that will have loaded it."
(interactive)
(unless (fboundp 'emms)
(emms-player-mpd-connect))
(emms))
(defun oni:term-mode-func ()
"Function for `term-mode-hook'."
(setq truncate-lines nil))
(defun oni:texinfo-mode-func ()
"Function for `texinfo-mode-hook'."
(auto-fill-mode))
(defun oni:view-mail (inbox)
"Show a menu with all mailbox options from `oni:mailbox-map'
for easy selection."
(interactive
(list (progn
(require 'tmm)
(let ((tmm-completion-prompt "Choose a mailbox\n"))
(tmm-prompt oni:mailbox-map)))))
(if inbox
(progn
(require 'mu4e)
(funcall (intern (concat "oni:" inbox "-mailbox")))
(mu4e))))
(defun oni:write-file-func ()
"Function for `write-file-hooks'."
(time-stamp))
(defun oni:yas-minor-mode-func ()
"Function for `yas-minor-mode-hook'."
(yas-load-directory (car yas-snippet-dirs)))
(provide 'oni)
;;; oni.el ends here

View file

@ -30,15 +30,18 @@
(custom-theme-set-faces (custom-theme-set-faces
'new 'new
'(default ((t (:background "#111113" :foreground "#eeeeec")))) '(default ((t (:background "#111113" :foreground "#eeeeec"))))
'(flymake-errline ((t (:background "#8b1a1a")))) '(flymake-errline ((t (:background nil :underline (:color "#ff5555" :style wave)))))
'(flymake-infoline ((t (:background "#00008b")))) '(flymake-infoline ((t (:background nil :underline (:color "#55ff55" :style wave)))))
'(flymake-warnline ((t (:background "#9a3200")))) '(flymake-warnline ((t (:background nil :underline (:color "#5555ff" :style wave)))))
'(font-lock-comment-delimiter-face ((t (:foreground "#a9a9a9" :slant italic :weight bold)))) '(font-lock-comment-delimiter-face ((t (:foreground "#a9a9a9" :slant italic :weight bold))))
'(font-lock-comment-face ((t (:foreground "#a9a9a9" :slant italic)))) '(font-lock-comment-face ((t (:foreground "#a9a9a9" :slant italic))))
'(font-lock-constant-face ((t (:foreground "#93d8d8"))))
'(font-lock-doc-face ((t (:foreground "#9ad870")))) '(font-lock-doc-face ((t (:foreground "#9ad870"))))
'(font-lock-function-name-face ((t (:foreground "#78a2c1"))))
'(font-lock-keyword-face ((t (:foreground "#cfce29")))) '(font-lock-keyword-face ((t (:foreground "#cfce29"))))
'(font-lock-string-face ((t (:foreground "#ffbd5c")))) '(font-lock-string-face ((t (:foreground "#ffbd5c"))))
'(font-lock-type-face ((t (:foreground "#78a2c1")))) '(font-lock-type-face ((t (:foreground "#78a2c1" :bold t))))
'(font-lock-variable-name-face ((t (:foreground "#c39cc3"))))
'(highlight ((t (:background "#171719")))) '(highlight ((t (:background "#171719"))))
'(ido-subdir ((t (:foreground "#ff5d55")))) '(ido-subdir ((t (:foreground "#ff5d55"))))
'(jabber-chat-prompt-foreign ((t (:foreground "#ff5d55")))) '(jabber-chat-prompt-foreign ((t (:foreground "#ff5d55"))))
@ -48,7 +51,21 @@
'(minibuffer-prompt ((t (:foreground "#78a2c1")))) '(minibuffer-prompt ((t (:foreground "#78a2c1"))))
'(mode-line ((t (:background "#222224" :foreground "#eeeeec" :box nil)))) '(mode-line ((t (:background "#222224" :foreground "#eeeeec" :box nil))))
'(mode-line-inactive ((t (:background "#171719" :foreground "#999999" :box nil)))) '(mode-line-inactive ((t (:background "#171719" :foreground "#999999" :box nil))))
'(org-level-1 ((t (:height 1.5))))
'(org-level-2 ((t (:height 1.4))))
'(org-level-3 ((t (:height 1.3))))
'(org-level-4 ((t (:height 1.2))))
'(org-level-5 ((t (:height 1.1))))
'(org-level-6 ((t (:height 1.0))))
'(org-level-7 ((t (:height 1.0))))
'(org-level-8 ((t (:height 1.0))))
'(region ((t (:background "#2729b6")))) '(region ((t (:background "#2729b6"))))
'(rst-level-1 ((t (:height 1.5 :background nil))))
'(rst-level-2 ((t (:height 1.4 :background nil))))
'(rst-level-3 ((t (:height 1.3 :background nil))))
'(rst-level-4 ((t (:height 1.2 :background nil))))
'(rst-level-5 ((t (:height 1.1 :background nil))))
'(rst-level-6 ((t (:height 1.0 :background nil))))
) )
(provide-theme 'new) (provide-theme 'new)

34
.fonts.conf Normal file
View file

@ -0,0 +1,34 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!-- settings go here -->
<match target="pattern">
<edit name="antialias" mode="assign">
<bool>true</bool>
</edit>
<edit name="hinting" mode="assign">
<bool>true</bool>
</edit>
<edit name="hintstyle" mode="assign">
<const>hintslight</const>
</edit>
<edit name="rgba" mode="assign">
<const>rgb</const>
</edit>
<edit name="autohint" mode="assign">
<bool>true</bool>
</edit>
</match>
<match target="font">
<edit name="lcdfilter" mode="assign">
<const>lcddefault</const>
</edit>
</match>
</fontconfig>

3
.moc/config Normal file
View file

@ -0,0 +1,3 @@
Layout1 = playlist(0,0,100%,100%):directory(0,0,100%,100%)
Layout2 = directory(0,0,50%,100%):playlist(50%,0,FILL,100%)
CanStartInPlaylist = yes

119
.sawfish/rc Normal file
View file

@ -0,0 +1,119 @@
(setq user-apps-menu
'(("Emacs" (system "emacsclient -c &"))
("Terminal" (system "urxvt &"))))
(define oni:window-packing-keymap (make-keymap))
(bind-keys oni:window-packing-keymap
"p" 'pack-window-up
"n" 'pack-window-down
"b" 'pack-window-left
"f" 'pack-window-right)
(define oni:window-growing-keymap (make-keymap))
(bind-keys oni:window-growing-keymap
"p" 'grow-window-up
"n" 'grow-window-down
"b" 'grow-window-left
"f" 'grow-window-right)
(define oni:window-shrinking-keymap (make-keymap))
(bind-keys oni:window-shrinking-keymap
"p" 'shrink-window-up
"n" 'shrink-window-down
"b" 'shrink-window-left
"f" 'shrink-window-right)
(define oni:window-yanking-keymap (make-keymap))
(bind-keys oni:window-yanking-keymap
"p" 'yank-window-up
"n" 'yank-window-down
"b" 'yank-window-left
"f" 'yank-window-right)
(define oni:window-management-keymap (make-keymap))
(bind-keys oni:window-management-keymap
"M" 'maximize-window-toggle
"p" oni:window-packing-keymap
"g" oni:window-growing-keymap
"s" oni:window-shrinking-keymap
"y" oni:window-yanking-keymap)
(bind-keys global-keymap
"XF86AudioPlay" '(run-shell-command "mpc toggle")
"XF86AudioStop" '(run-shell-command "mpc stop")
"XF86AudioMute" '(run-shell-command "amixer sset Master toggle")
"XF86AudioLowerVolume" '(run-shell-command "mpc volume -5")
"XF86AudioRaiseVolume" '(run-shell-command "mpc volume +5")
"XF86AudioPrev" '(run-shell-command "mpc prev")
"XF86AudioNext" '(run-shell-command "mpc next"))
(require 'sawfish.wm.util.prompt)
(define oni:extended-keymap (make-keymap))
(bind-keys oni:extended-keymap
"w" oni:window-management-keymap)
;; (ungrab-keymap global-keymap)
(bind-keys global-keymap
"Super-!" '(run-shell-command (prompt-for-string "Run: "))
"C-M-l" '(run-shell-command "i3lock -c \"#000000\"")
"Super-e" '(run-shell-command (getenv "EDITOR"))
"Super-w" '(run-shell-command (getenv "BROWSER"))
"Super-c" '(run-shell-command "urxvt")
"Super-TAB" 'cycle-windows
"Super-x" oni:extended-keymap
"Menu" 'popup-root-menu)
;; (grab-keymap global-keymap)
(setq prompt-color (cons (get-color "#eeeeec")
(get-color "#252e2b")))
(setq default-frame-style 'naquadah)
(require 'sawfish.wm.ext.match-window)
(add-window-matcher '((WM_CLASS . "^Firefox/Navigator$"))
'((position . north-east)))
(require 'rep.regexp)
(require 'sawfish.wm.commands.grow-pack)
(require 'sawfish.wm.commands.shrink-yank)
(defun oni:emacs-main-window-p (window)
"Check wether or not WINDOW is Emacs' main window."
(let ((name (window-name window)))
(and (string-match "^emacs: " name)
(not (string= "emacs: *Sauron*" name)))))
(defun oni:place-emacs-windows ()
"Place Emacs' main, sauron and optionally speedbar windows the
way I like them."
(let ((main-window (car (filter-windows oni:emacs-main-window-p)))
(sauron-window (get-window-by-name "emacs: *Sauron*"))
(speedbar-window (get-window-by-name "^Speedbar " #:regex t)))
(move-window-to main-window 0 0)
(move-window-to sauron-window 0 0)
(set-window-type sauron-window 'transient)
(pack-window-down sauron-window)
(grow-window-right sauron-window)
(when speedbar-window
(move-window-to speedbar-window 0 0)
(set-window-type speedbar-window 'transient)
(yank-window-right main-window)
(grow-window-down speedbar-window))
(grow-window-down main-window)
(grow-window-right main-window)))
(define-command 'oni:place-emacs-windows oni:place-emacs-windows)
(bind-keys oni:window-management-keymap
"E" 'oni:place-emacs-windows)

305
.scwmrc Normal file
View file

@ -0,0 +1,305 @@
;; -*- mode: scheme; -*-
;; simple.scwmrc was system.scwmrc until Scwm-0.99.2
;; Uncomment the below to send a single UDP packet to
;; the scwm usage counter machine at startup
;; The single packet just contains the hostname and version number
;; To disable, set environment variable SCWM_DO_NOT_LOG_USAGE
;;(define thank-scwm-authors-with-usage-note #t)
(define user-image-load-path
(list (string-append (user-home) "/src/scwm/pixmaps")
(string-append (user-home) "/src/scwm/bitmaps")))
;;; set path to use for image searches
(set! image-load-path
(append
user-image-load-path
'("/usr/X11/lib/X11/mini-icons" "/usr/X11/include/X11/pixmaps"
"/usr/lib/icons" "/usr/local/X11/include/X11/pixmaps"
"/usr/local/lib/icons" "/usr/local/icons"
"/uns/share/include/X11/pixmaps" "/uns/share/include/X11/bitmaps")
image-load-path))
;;-------------------------------;;
;; import the scwm modules ;;
#!
(use-scwm-modules minimal base winops winlist wininfo
doc style message-window face
preferences style
;optargs winlist-menu)
winlist-menu)
!#
(use-modules
(app scwm minimal)
(app scwm base)
(app scwm style)
(app scwm winops)
(app scwm winlist)
(app scwm wininfo)
(app scwm doc)
(app scwm message-window)
(app scwm face)
;(app scwm preferences)
(app scwm optargs)
(app scwm winlist-menu))
;;-------------------------------;;
;; set some basic styles info ;;
(define font
(make-font "-unknown-DejaVu Sans Mono-normal-normal-normal-*-18-*-*-*-m-0-iso10646-1"))
(menu-style #:fg "#eeeeec"
#:bg "#252a2b"
#:stipple "blue"
#:hl-fg "yellow"
#:font font)
(title-style #:font font #:justify 'left)
(set-icon-font! font)
(set-highlight-foreground! "white")
(set-highlight-background! "blueviolet")
(set-rubber-band-mask! 127)
;;-------------------------------;;
;; set some paths ;;
;;
;; these are OK for my system, but may need to be changed for
;; yours. This should probably be eventually autoconfed or something.
;;; set path to use for image searches
(set! image-load-path
(append
user-image-load-path
'("/usr/X11/lib/X11/mini-icons" "/usr/X11/include/X11/pixmaps"
"/usr/lib/icons" "/usr/local/X11/include/X11/pixmaps"
"/usr/local/lib/icons" "/usr/local/icons"
"/uns/share/include/X11/pixmaps" "/uns/share/include/X11/bitmaps")
image-load-path))
;;-------------------------------;;
;; set some window styles ;;
(window-style "*"
#:fg "white" #:bg "navy"
#:icon "unknown1.xpm"
#:icon-box (list (x- 70) 1 69 (y- 141))
#:border-width 6
#:focus 'mouse
#:mwm-func-hint #t #:mwm-decor-hint #t
#:hint-override #t #:decorate-transient #t
#:PPosition-hint #f
#:lenience #t
)
(define desk-widget
(make-style #:plain-border #t #:sticky #t #:winlist-skip #t
#:border-width 3 #:focus 'none))
(window-style "*lock" #:use-style desk-widget)
(window-style "xload" #:no-titlebar #t #:use-style desk-widget)
(window-style "xscreensaver" #:no-titlebar #t #:use-style desk-widget)
(window-style "xbiff" #:no-titlebar #t #:use-style desk-widget)
(window-style "xcalc" #:icon "xcalc.xpm")
(window-style "xman" #:icon "xman.xpm")
(window-style "xmag" #:icon "mag_glass.xpm")
(window-style "Emacs" #:icon "gnu-animal.xpm")
(window-style "XTerm" #:icon "xterm.xpm")
;; People seem to prefer move by full virtual desks
(set-edge-resistance! 500 10)
(set-edge-scroll! (%x 100) (%y 100))
;;-------------------------------;;
;; define some useful menus ;;
(define window-ops-menu
(menu
(list
(menu-title "Window Ops") menu-separator
(menuitem "Move" #:action interactive-move)
(menuitem "Resize" #:action interactive-resize)
(menuitem "Raise" #:action raise-window)
(menuitem "Lower" #:action lower-window)
;; (menuitem "Print" #:action print-window)
(menuitem "(Un)Window-Shade" #:action toggle-window-shade)
(menuitem "(De)Iconify" #:action toggle-iconify)
(menuitem "(Un)Maximize" #:action toggle-maximize-vertical)
(menuitem "(Un)Stick" #:action toggle-stick)
(menuitem "(Un)Keep On Top" #:action toggle-on-top)
menu-separator
(menuitem "Close" #:action close-window)
(menuitem "Delete" #:action delete-window)
(menuitem "Destroy" #:action destroy-window)
menu-separator
(menuitem "Refresh Screen" #:action refresh))))
(define* (popup-ops)
""
(interactive)
(popup-menu window-ops-menu))
;; Hack to let quit work
(set-procedure-property! quit 'interactive #t)
(define menu-quit-verify
(menu
(list
(menu-title "Really quit scwm?") menu-separator
;;(menuitem "Yes" #:action scheme-quit)
(menuitem "Yes" #:action quit)
(menuitem "No" #:action #f)
menu-separator
(menuitem "Restart scwm" #:action (lambda () (restart "scwm"))))))
(define (quit-verify)
(popup-menu menu-quit-verify))
(define desk-menu
(menu
(list
(menu-title "Desks") menu-separator
(menuitem "Desk 1" #:action (lambda () (set-current-desk! 0)))
(menuitem "Desk 2" #:action (lambda () (set-current-desk! 1)))
(menuitem "Desk 3" #:action (lambda () (set-current-desk! 2)))
(menuitem "Desk 4" #:action (lambda () (set-current-desk! 3))))))
(define util-menu
(menu
(list
(menu-title "Utilities") menu-separator
;(menuitem "Preferences..." #:action scwm-options-dialog)
menu-separator
(menuitem "urxvt" #:action (lambda () (execute "urxvt")))
(menuitem "emacs" #:action (lambda () (execute "emacsclient -c -a emacs")))
(menuitem "firefox" #:action (lambda () (execute "firefox")))
(menuitem "top" #:action
(lambda () (execute "urxvt -T Top -n Top -e top")))
menu-separator
(menuitem "Desks" #:action desk-menu)
menu-separator
(menuitem "Exit scwm" #:action menu-quit-verify))))
(define* (popup-util)
""
(interactive)
(popup-menu util-menu))
(define (make-small-window-ops-menu w)
(menu
(list
;; (menu-title "Window Ops2")
;; menu-separator
(menuitem "Move" #:action interactive-move)
(menuitem "Resize" #:action interactive-resize)
(menuitem "Raise" #:action raise-window)
(menuitem "Lower" #:action lower-window)
(menuitem "Iconify" #:action iconify-window)
menu-separator
(menuitem "More..." #:action
(menu
(list
(menuitem (if (maximized? w)
"Unmaximize"
"Maximize")
#:action toggle-maximize-vertical)
(menuitem (if (sticky-window? w)
"Unstick"
"Stick") #:action toggle-stick)
(menuitem (if (shaded-window? w)
"UnWindow-Shade"
"Window-Shade")
#:action toggle-window-shade)
(menuitem (if (kept-on-top? w)
"UnKeep On Top"
"Keep On Top") #:action toggle-on-top))))
menu-separator
(menuitem "Close" #:action close-window)
(menuitem "Destroy" #:action destroy-window))))
(define* (popup-small-ops)
"" (interactive)
(popup-menu (make-small-window-ops-menu (get-window))))
;; now set some mouse and key bindings ;;
;; first our root menus
(bind-mouse 'root 1 popup-util)
(bind-mouse 'root 2 popup-ops)
(bind-mouse 'root 3 (lambda ()
(show-window-list-menu #f #f #:show-geometry #t)))
(bind-mouse 'root "M-3" (lambda () (popup-menu desk-menu)))
;; window buttons
(bind-mouse 'left-button-1 1 popup-small-ops)
(bind-mouse 'right-button-1 1 toggle-maximize-vertical)
(bind-mouse 'right-button-2 1 iconify-window)
;; operations on parts of the window
(bind-mouse '(frame-corners frame-sides) 2 popup-small-ops)
(bind-mouse 'frame-corners 1 resize-or-raise)
(bind-mouse 'frame-sides 1 move-or-raise)
(define* (move-or-shade)
""
(interactive)
(case (mouse-event-type)
((double-click) (toggle-window-shade))
(else (move-or-raise))))
(bind-mouse 'title 1 move-or-shade)
(bind-mouse 'title 3 lower-window)
;; key bindings for the menus
(bind-key 'all "M-F1" popup-util)
(bind-key 'all "M-F2" popup-ops)
;; in case of emergency, hit Control-Meta-Shift-Q
(bind-key 'all "C-M-S-q" quit-verify)
;; some stuff for icons
(define* (move-or-deiconify)
""
(interactive)
(case (mouse-event-type)
((motion) (interactive-move))
((double-click) (deiconify-window))))
(bind-mouse 'icon 1 move-or-deiconify)
(bind-mouse 'icon 2 deiconify-window)
;; move the pointer with the keyboard
(bind-key 'all "M-Left" (lambda () (move-pointer (%x -1) 0)))
(bind-key 'all "M-Right" (lambda () (move-pointer (%x 1) 0)))
(bind-key 'all "M-Up" (lambda () (move-pointer 0 (%y -1))))
(bind-key 'all "M-Down" (lambda () (move-pointer 0 (%y 1))))
;; move the viewport with the keyboard
(bind-key 'all "C-M-Left" (lambda () (move-viewport (%x -100) 0)))
(bind-key 'all "C-M-Right" (lambda () (move-viewport (%x 100) 0)))
(bind-key 'all "C-M-Up" (lambda () (move-viewport 0 (%y -100))))
(bind-key 'all "C-M-Down" (lambda () (move-viewport 0 (%y 100))))
;; rotate the current window with the keyboard
(bind-key 'all "C-S-Tab"
(lambda ()
(next-window #:only visible? #:except iconified-window?)))
(bind-key 'all "M-S-Tab"
(lambda ()
(prev-window #:only visible? #:except iconified-window?)))

View file

@ -12,4 +12,4 @@ fi
# rox -b Default # rox -b Default
test -n "$1" && wm=$1 || wm="awesome" # wm="emacsclient -ce \"(oni:wm-init)\"" test -n "$1" && wm=$1 || wm="awesome" # wm="emacsclient -ce \"(oni:wm-init)\""
exec ck-launch-session $wm exec $wm

View file

@ -1,6 +0,0 @@
#!/bin/bash
herbstclient rule pseudotile=on once
emacs -Q -l ~/.emacs.d/site-lisp/org-init.elc \
--execute "(progn (org-capture) (delete-other-windows)
(add-hook 'org-capture-after-finalize-hook 'kill-emacs))"

View file

@ -1,5 +0,0 @@
#!/bin/bash
grep --color=never "* \(TODO\|IN PROGRESS\|WAITING\)" org/notes.org \
| sed 's/\*/ /g' \
| xmessage -file - -default okay

View file

@ -1,4 +0,0 @@
#!/bin/bash
/usr/bin/cower -uq 2>/dev/null \
| wc -l 2>/dev/null > ~/.local/share/aur.cnt

View file

@ -1,4 +0,0 @@
#!/bin/bash
/usr/bin/pacman -Qu 2>/dev/null \
| wc -l 2>/dev/null > ~/.local/share/updates.cnt