Merge branch 'master' of git.distorted.org.uk:~mdw/publish/public-git/profile
[profile] / el / dot-emacs.el
index 1b9f24e..d657295 100644 (file)
@@ -226,6 +226,13 @@ frame is actually mapped on the screen."
 
 (mdw-advise-to-inhibit-raise-frame select-frame-set-input-focus)
 
+;; Bug fix for markdown-mode, which breaks point positioning during
+;; `query-replace'.
+(defadvice markdown-check-change-for-wiki-link
+    (around mdw-save-match activate compile)
+  "Save match data around the `markdown-mode' `after-change-functions' hook."
+  (save-match-data ad-do-it))
+
 ;; Transient mark mode hacks.
 
 (defadvice exchange-point-and-mark
@@ -810,6 +817,8 @@ case."
       (whitespace-mode arg))
     (setq show-trailing-whitespace whitespace-mode)))
 
+(defvar mdw-do-misc-mode-hacking nil)
+
 (defun mdw-misc-mode-config ()
   (and mdw-auto-indent
        (cond ((eq major-mode 'lisp-mode)
@@ -835,11 +844,17 @@ case."
   (trap (turn-on-font-lock)))
 
 (defun mdw-post-local-vars-misc-mode-config ()
-  (when mdw-do-misc-mode-hacking
+  (when (and mdw-do-misc-mode-hacking
+            (not buffer-read-only))
     (setq show-trailing-whitespace t)
     (mdw-whitespace-mode 1)))
 (add-hook 'hack-local-variables-hook 'mdw-post-local-vars-misc-mode-config)
 
+(defadvice toggle-read-only (after mdw-angry-fruit-salad activate)
+  (when mdw-do-misc-mode-hacking
+    (setq show-trailing-whitespace (not buffer-read-only))
+    (mdw-whitespace-mode (if buffer-read-only 0 1))))
+
 (eval-after-load 'gtags
   '(progn
      (dolist (key '([mouse-2] [mouse-3]))
@@ -1228,7 +1243,7 @@ doesn't match any of the regular expressions in
 (mdw-define-face mdw-ellipsis-face
   (((type tty)) :foreground "blue") (t :foreground "grey60"))
 (let ((dollar (make-glyph-code ?$ 'mdw-ellipsis-face))
-      (backslash (make-glyph-code ?\ 'mdw-ellipsis-face))
+      (backslash (make-glyph-code ?\\ 'mdw-ellipsis-face))
       (dot (make-glyph-code ?. 'mdw-ellipsis-face))
       (bar (make-glyph-code ?| mdw-ellipsis-face)))
   (set-display-table-slot standard-display-table 0 dollar)
@@ -2108,6 +2123,8 @@ doesn't match any of the regular expressions in
 
 ;; Perl indentation style.
 
+(setq perl-indent-level 2)
+
 (setq cperl-indent-level 2)
 (setq cperl-continued-statement-offset 2)
 (setq cperl-continued-brace-offset 0)