el/dot-emacs.el: Fix configuration for SQL mode.
[profile] / el / dot-emacs.el
index a90c58a..bc512b4 100644 (file)
@@ -55,8 +55,7 @@ This may be at the expense of cool features.")
 ;;; Some general utilities.
 
 (eval-when-compile
-  (unless (fboundp 'make-regexp)
-    (load "make-regexp"))
+  (unless (fboundp 'make-regexp) (load "make-regexp"))
   (require 'cl))
 
 (defmacro mdw-regexps (&rest list)
@@ -368,6 +367,9 @@ it's currently off."
 
 ;; Functions for sexp diary entries.
 
+(defvar mdw-diary-for-org-mode-p nil
+  "Display diary along with the agenda?")
+
 (defun mdw-not-org-mode (form)
   "As FORM, but not in Org mode agenda."
   (and (not mdw-diary-for-org-mode-p)
@@ -447,9 +449,6 @@ as output rather than a string."
                                (nth 2 when))))))))
     (eq w d)))
 
-(defvar mdw-diary-for-org-mode-p nil
-  "Display diary along with the agenda?")
-
 (defadvice org-agenda-list (around mdw-preserve-links activate)
   (let ((mdw-diary-for-org-mode-p t))
     ad-do-it))
@@ -1096,21 +1095,6 @@ tramp, which seems to get itself into a twist."
   (let ((auto-revert-check-vc-info t))
     (auto-revert-buffers)))
 
-(defun comint-send-and-indent ()
-  (interactive)
-  (comint-send-input)
-  (and mdw-auto-indent
-       (indent-for-tab-command)))
-
-(defadvice comint-line-beginning-position
-    (around mdw-calculate-it-properly () activate compile)
-  "Calculate the actual line start for multi-line input."
-  (if (or comint-use-prompt-regexp
-         (eq (field-at-pos (point)) 'output))
-      ad-do-it
-    (setq ad-return-value
-           (constrain-to-field (line-beginning-position) (point)))))
-
 ;;;--------------------------------------------------------------------------
 ;;; Dired hacking.
 
@@ -3153,6 +3137,7 @@ name, as a symbol."
 
 (setq-default cperl-indent-level 2
              cperl-continued-statement-offset 2
+             cperl-indent-region-fix-constructs nil
              cperl-continued-brace-offset 0
              cperl-brace-offset -2
              cperl-brace-imaginary-offset 0
@@ -4244,7 +4229,7 @@ strip numbers instead."
 ;;;--------------------------------------------------------------------------
 ;;; HTML, CSS, and other web foolishness.
 
-(setq-default css-indent-offset 2)
+(setq-default css-indent-offset 8)
 
 ;;;--------------------------------------------------------------------------
 ;;; SGML hacking.
@@ -4807,11 +4792,12 @@ align the other subforms beneath it.  Otherwise, indent them
   (if mdw-friendly-name (setq ad-return-value mdw-friendly-name)
     ad-do-it))
 
-(trap
- (if (not mdw-fast-startup)
-     (progn
-       (require 'slime-autoloads)
-       (slime-setup '(slime-autodoc slime-c-p-c)))))
+(eval-and-compile
+  (trap
+    (if (not mdw-fast-startup)
+       (progn
+         (require 'slime-autoloads)
+         (slime-setup '(slime-autodoc slime-c-p-c))))))
 
 (let ((stuff '((cmucl ("cmucl"))
               (sbcl ("sbcl") :coding-system utf-8-unix)
@@ -4943,6 +4929,21 @@ align the other subforms beneath it.  Otherwise, indent them
   (auto-fill-mode -1)
   (setq tab-width 8))
 
+(defun comint-send-and-indent ()
+  (interactive)
+  (comint-send-input)
+  (and mdw-auto-indent
+       (indent-for-tab-command)))
+
+(defadvice comint-line-beginning-position
+    (around mdw-calculate-it-properly () activate compile)
+  "Calculate the actual line start for multi-line input."
+  (if (or comint-use-prompt-regexp
+         (eq (field-at-pos (point)) 'output))
+      ad-do-it
+    (setq ad-return-value
+           (constrain-to-field (line-beginning-position) (point)))))
+
 (defun term-send-meta-right () (interactive) (term-send-raw-string "\e\e[C"))
 (defun term-send-meta-left  () (interactive) (term-send-raw-string "\e\e[D"))
 (defun term-send-ctrl-uscore () (interactive) (term-send-raw-string "\C-_"))
@@ -5098,6 +5099,15 @@ there is sadness."
   (set-window-dedicated-p (or window (selected-window)) nil))
 
 ;;;--------------------------------------------------------------------------
+;;; SQL stuff.
+
+(setq sql-postgres-options '("-n" "-P" "pager=off")
+      sql-postgres-login-params
+       '((user :default "mdw")
+         (database :default "mdw")
+         (server :default "db.distorted.org.uk")))
+
+;;;--------------------------------------------------------------------------
 ;;; Man pages.
 
 ;; Turn off `noip' when running `man': it interferes with `man-db''s own