bin/mdw-pager: Don't be a pager if called by Emacs M-x grep.
[profile] / el / dot-emacs.el
index f21af7f..8bb88c3 100644 (file)
@@ -321,6 +321,43 @@ Evil key bindings are defined in `mdw-evil-keymap-keys'."
       org-export-docbook-xslt-stylesheet
       "/usr/share/xml/docbook/stylesheet/docbook-xsl/fo/docbook.xsl")
 
+;; Some hacks to do with window placement.
+
+(defun mdw-clobber-other-windows-showing-buffer (buffer-or-name)
+  "Arrange that no windows on other frames are showing BUFFER-OR-NAME."
+  (interactive "bBuffer: ")
+  (let ((home-frame (selected-frame))
+       (buffer (get-buffer buffer-or-name))
+       (safe-buffer (get-buffer "*scratch*")))
+    (mapc (lambda (frame)
+           (or (eq frame home-frame)
+               (mapc (lambda (window)
+                       (and (eq (window-buffer window) buffer)
+                            (set-window-buffer window safe-buffer)))
+                     (window-list frame))))
+         (frame-list))))
+
+(defvar mdw-inhibit-walk-windows nil
+  "If non-nil, then `walk-windows' does nothing.
+This is used by advice on `switch-to-buffer-other-frame' to inhibit finding
+buffers in random frames.")
+
+(defadvice walk-windows (around mdw-inhibit activate)
+  "If `mdw-inhibit-walk-windows' is non-nil, then do nothing."
+  (and (not mdw-inhibit-walk-windows)
+       ad-do-it))
+
+(defadvice switch-to-buffer-other-frame
+    (around mdw-always-new-frame activate)
+  "Always make a new frame.
+Even if an existing window in some random frame looks tempting."
+  (let ((mdw-inhibit-walk-windows t)) ad-do-it))
+
+(defadvice display-buffer (before mdw-inhibit-other-frames activate)
+  "Don't try to do anything fancy with other frames.
+Pretend they don't exist.  They might be on other display devices."
+  (ad-set-arg 2 nil))
+
 ;;;--------------------------------------------------------------------------
 ;;; Mail and news hacking.
 
@@ -573,10 +610,10 @@ If NEW-SESSION-P, start a new session."
        (select-window window)))))
 
 (defvar mdw-good-url-browsers
-  '(browse-url-generic
+  '(browse-url-mozilla
+    browse-url-generic
     (w3m . mdw-w3m-browse-url)
-    browse-url-w3
-    browse-url-mozilla)
+    browse-url-w3)
   "List of good browsers for mdw-good-url-browsers.
 Each item is a browser function name, or a cons (CHECK . FUNC).
 A symbol FOO stands for (FOO . FOO).")
@@ -865,6 +902,10 @@ doesn't match any of the regular expressions in
   (((type tty) (class color)) :background "blue")
   (((type tty) (class mono)) :inverse-video t)
   (t :background "grey30"))
+(mdw-define-face match
+  (((type tty) (class color)) :background "blue")
+  (((type tty) (class mono)) :inverse-video t)
+  (t :background "blue"))
 (mdw-define-face mc/cursor-face
   (((type tty) (class mono)) :inverse-video t)
   (t :background "red"))
@@ -1507,6 +1548,9 @@ doesn't match any of the regular expressions in
 
 (defun mdw-fontify-scala ()
 
+  ;; Comment filling.
+  (setq mdw-fill-prefix mdw-c-comment-fill-prefix)
+
   ;; Define things to be fontified.
   (make-local-variable 'font-lock-keywords)
   (let ((scala-keywords
@@ -1518,7 +1562,7 @@ doesn't match any of the regular expressions in
                      "var" "while" "with" "yield"))
        (scala-constants
         (mdw-regexps "false" "null" "super" "this" "true"))
-       (punctuation "\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/"))
+       (punctuation "[-!%^&*=+:@#~/?\\|`]"))
 
     (setq font-lock-keywords
          (list
@@ -1900,7 +1944,6 @@ doesn't match any of the regular expressions in
 
 ;; Perl indentation style.
 
-(fset 'perl-mode 'cperl-mode)
 (setq cperl-indent-level 2)
 (setq cperl-continued-statement-offset 2)
 (setq cperl-continued-brace-offset 0)