FFAP and Ruby in Emacs

If you want to use FFAP (find-file-at-point) in ruby-mode you can add this to your .emacs

(defvar ruby-program-name "ruby")
(defun ruby-module-path(module)
(shell-command-to-string
(concat
ruby-program-name " -e "
"\"ret=’()’;$LOAD_PATH.each{|p| "
"x=p+’/'+ARGV[0].gsub(’.rb’, ”)+’.rb’;" [...]

Emacs config

To anyone interested my extensive Emacs configuration is available here :
http://code.google.com/p/chmouel/source
And here is the usual screen shot :

Always search before coding

This is a annoying, even if it take 5mn to code thing like that :

(defun my-dired-rm-rf()
"Rm -rf directories"
(interactive)
(let ((sel (selected-window)))
(dolist (curFile (dired-get-marked-files))
(if (yes-or-no-p (concat "Do you want to remove \"" (file-name-nondirectory curFile) "\" ? "))
(progn
(shell-command (concat "rm -rvf " curFile)
"*Removing Directories*")
(kill-buffer "*Removing Directories*")
(select-window sel)
(revert-buffer)
)
))
))

you [...]

Emacs nighly cvs snapshot with xft on Ubuntu Edgy

I wanted to try the latest cvs snapshot with XFT support, since i did not want to screw up more my workstation i have used packages instead of make install blindy.
Basically i have a script called ./build.sh

#!/bin/bash
set -e
 
d=$(date ‘+%Y%m%d’)
debpatch=20061218-1
 
mkdir -p cvs
 
pushd cvs >/dev/null && {
cvs -Q -z3 -d:pserver:anonymous@cvs.savannah.gnu.org:/sources/emacs co -r emacs-unicode-2 emacs
} && popd >/dev/null
 
mkdir [...]

Rename bunch of file via regexp

To rename bunch of files via regexp i was using before a homegrown python script call rename-regexp.py to change bunch of files with a regexp.
But since then i discovered wdired which is pretty fantastic to use that from emacs. With the extended “query-replace-regexp“ from Emacs22 stuff are much easier to rename.

My first webpage

Classic my first webpage is still on the web that was back in 98 and that was about Emacs
http://membres.lycos.fr/crblinux/html/xemacs.html
It is in french thought.

Xterm like Control-L in Eshell

If you want to emulate Control-L in Eshell (the Emacs Shell) like in Xterm, you can use this :

(defun eshell-show-minimum-output ()
(interactive)
(goto-char (eshell-beginning-of-output))
(set-window-start (selected-window)
(save-excursion
(goto-char (point-max))
(line-beginning-position)))
(eshell-end-of-output))

And add a key bind to it in [...]

Cheetah Mode for Emacs

Here is a simple html derived mode for Cheetah templates files. The font-locking regexp can be improved thought but that’s a start.

(define-derived-mode cheetah-mode html-mode "Cheetah"
(make-face ‘cheetah-variable-face)
(font-lock-add-keywords
nil
‘(
("\\(#\\(from\\|else\\|include\\|set\\|import\\|for\\|if\\|end\\)+\\)\\>" 1 font-lock-type-face)
("\\(#\\(from\\|for\\|end\\)\\).*\\<\\(for\\|import\\|if\\|in\\)\\>" 3 font-lock-type-face)
("\\(\\$\\(?:\\sw\\|}\\|{\\|\\s_\\)+\\)" [...]

Access Gajim within Emacs

Here is some function to launch a gajim window from Emacs :

(defvar gajim-remote "/usr/bin/gajim-remote")
(defvar gajim-user-list ())
 
(defun my-gajim-get-list()
(save-excursion
(with-temp-buffer
(call-process gajim-remote nil t nil "list_contacts")
(goto-char (point-min))
(while (re-search-forward "^jid[ ]*:[ ]*\\(.*\\)$" (point-max) t )
[...]