 (setq compilation-scroll-output t)
 (setq compilation-window-height 8)
 
+(defun my-lgrep-ignore-directories (orig-fun &rest args)
+  (let ((oldval (getenv "GREP_OPTIONS")))
+    (setenv "GREP_OPTIONS" "-d skip")
+    (let ((res (apply orig-fun args)))
+      (setenv "GREP_OPTIONS" oldval)
+      res)))
+(advice-add 'lgrep :around #'my-lgrep-ignore-directories)
+
 (setq compilation-finish-function
       (lambda (buf str)
 
-	(if (string-match "exited abnormally" str)
-
-	    ;;there were errors
-	    (message "compilation errors, press C-x ` to visit")
-
-	  ;;no errors, possibly make the compilation window go away
-	  (if my-cleanup-compilation-window-flag
-	      (run-at-time 0.5 nil 'delete-windows-on buf))
-	  (message "NO COMPILATION ERRORS!"))))
+        ;; handle grep differently - 0 is matches, 1 is no matches
+	(if (string= "*grep*" (buffer-name buf))
+            (if (and (string-match "exited abnormally" str)
+                     my-cleanup-compilation-window-flag)
+                (run-at-time 0.5 nil 'delete-windows-on buf))
+
+          ;; handle regular compile errors
+          (if (string-match "exited abnormally" str)
+
+              ;;there were errors
+              (message "compilation errors, press C-x ` to visit")
+            
+            ;;no errors, possibly make the compilation window go away
+            (if my-cleanup-compilation-window-flag
+                (run-at-time 0.5 nil 'delete-windows-on buf))
+            (message "NO COMPILATION ERRORS!")))))
 
 ;; SHELL section
 (require 'shell)


(require 'compile)

;;make -k isn't what I want
(setq-default compile-command "make")
(make-variable-buffer-local 'compile-command)

;;     (not matched-ignored-filename)))
;; (setq backup-each-save-filter-function 'backup-each-save-filter)

