# HG changeset patch
# User Augie Fackler <durin42@gmail.com>
# Date 1281841120 18000
# Node ID b9b118dba61a157049d5c2258c91cd9c876f3731
# Parent  e4842709368ab26c08298d977f134cea8ba727ba
emacs: make diff-mode mq-aware

diff --git a/.elisp/settings/40.modes.el b/.elisp/settings/40.modes.el
--- a/.elisp/settings/40.modes.el
+++ b/.elisp/settings/40.modes.el
@@ -87,3 +87,10 @@ point."
           (lambda ()
             (c-set-offset 'topmost-intro-cont
                           annotation-fix)))
+
+;; mq diff-mode support
+(add-to-list 'auto-mode-alist '("\\.hg/patches/" . diff-mode))
+(defun mq-patch-set-default-directory ()
+  (when (string= ".hg" (nth 2 (reverse (split-string default-directory "/"))))
+    (setq default-directory (expand-file-name (concat default-directory "../../")))))
+(add-hook 'diff-mode-hook 'mq-patch-set-default-directory)