Archive for the 'Code' Category

Smarter trailing whitespace deletion

Friday, August 15th, 2008

I used to use delete-trailing-whitespace in my local-file-write-hooks for any source file I edited, but I had to disable it a while back. Many files containing legacy source were extremely messy in this regard, and it made making simple fixes harder to track, since there was a large amount of noise in the diff from [...]

Support for `user@host’ in ssh-mode

Wednesday, August 13th, 2008

One of my long-time pet peeves with ssh-mode is that it doesn’t understand user@host syntax. If you want to log in to a remote host as a different user, you must use the more verbose host -l user syntax. If you don’t, and you use the `ftp’ ssh-directory-tracking-mode, tramp gets confused and tries to connect [...]

Silence php-mode HTML warnings

Tuesday, August 12th, 2008

php-mode 1.4.0 added warnings about mixing PHP and HTML. They pop up often, and I find them extremely annoying. Even when I’m printing HTML with echo, I get them. To silence them forever, add this to .emacs:

(add-hook ‘php-mode-hook (lambda () (setq php-warned-bad-indent t)))

Last dirtrack issue solved

Friday, August 8th, 2008

Turns out the problem I ran into was a clash between dirtrack-mode and shell-dirtrack-mode. I had no idea there were two competing packages; the problem was that dirtrack picked up the new path, then shell-dirtrack noticed the “cd ..”.
Solved:

(add-hook ’shell-mode-hook
(lambda ()
[...]

Fixing dirtrack

Monday, August 4th, 2008

One of the problems I’ve had with various emacsen is the shell dirtrack support. This keeps the shell-mode’s idea of what directory you’re in in sync with which one you’re actually in. At least in Aquamacs, this support is not very good, and it will break if you use bash features like CDPATH or “cd [...]