Pages

Sunday, October 25, 2009

Python Mode In Emacs 23



I have updated my python programming section at my personal web to include use of flymake and iPython. Works really really well. That and company mode for completion makes quite a nice little python environment.


http://richardriley.net/projects/emacs/dotprogramming

Saturday, October 17, 2009

python in emacs





;;;;;
;************************************************
; rgr-python.el
;
; python integration
; Richard Riley.
; http://richardriley.net/default/projects/emacs/
;************************************************

(autoload 'python-mode "python-mode" "Python Mode." t)
(add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode))
(add-to-list 'interpreter-mode-alist '("python" . python-mode))

(setq load-path
(append (list nil
"~/.emacs.d/lisp/pymacs/"
"~/.emacs.d/lisp/pysmell"
)
load-path))

(require 'ipython)
(setq python-python-command "ipython")
(setq py-python-command-args '( "-colors" "Linux"))

(require 'pymacs)
(pymacs-load "ropemacs" "rope-")
(setq ropemacs-enable-autoimport t)

(add-hook 'python-mode-hook
'(lambda ()
(set (make-local-variable 'hippie-expand-try-functions-list) (add-to-list 'hippie-expand-try-functions-list 'try-pysmell-complete))))

(provide 'rgr-python)


Sunday, October 4, 2009

udev rules for firing up a phone manager on Debian

I just got udev rules working for adding and removal of my Sony Eriksson W760i on Debian Linux. It was a real swine to get working : primarily because of the lack of info about X issues when calling scripts from the udev process. Anyway here is how its done:

1) Create a local udev script file:

/etc/udev/rules.d/z21_local.rules

ACTION=="add",KERNEL=="ttyACM0",SUBSYSTEM=="tty",ATTRS{product}=="Sony Ericsson W760",ATTRS{serial}=="3570670210310730",RUN+="/home/shamrock/bin/phonelaunch",SYMLINK+="w760i"
ACTION=="remove",KERNEL=="ttyACM0",SUBSYSTEM=="tty",RUN+="/home/shamrock/bin/phonekill"


2) Script to lauch Wammu


#!/bin/bash
export HOME = /home/shamrock
set -x
xhost local:shamrock
export DISPLAY=:0.0
cd /home/shamrock
su shamrock -c "/usr/bin/wammu &"


3) Script to clean up on removal


#!/bin/bash
su shamrock -c "pkill wammu"



The details for the udev rules came from running:

sudo udevadm info --name=/dev/ttyACM0 --query=all --attribute-walk


Enjoy!