 (defun me:replace-all (input from to)
   (replace-regexp-in-string (regexp-quote from) to input nil))
 
+;; run hook function on buffer after a delay
+(defmacro me:add-hook-with-delay (hook delay func)
+    `(add-hook ,hook
+               (lambda ()
+                 (let ((cur-buf (current-buffer)))
+                   (run-at-time ,delay nil
+                                (lambda ()
+                                  (save-current-buffer
+                                    (if (buffer-live-p cur-buf)
+                                        (progn
+                                          (set-buffer cur-buf)
+                                          (funcall ,func))))))))))
 
 ;; configuration I haven't figured out how to wedge into
 ;; use-package

  :diminish modern-c++-font-lock-mode
  :config
  :init
  (add-hook 'c++-mode-hook #'modern-c++-font-lock-mode))


(use-package compile

          whitespace-style '(face trailing tabs tab-mark lines-tail space-before-tab)
          whitespace-display-mappings '((tab-mark 9 [9657 9] [92 9])))
    (add-hook 'whitespace-mode-hook 'me:set-extra-font-attributes)
    (me:add-hook-with-delay 'prog-mode-hook 7 #'whitespace-mode)
  :diminish whitespace-mode)

;; N.B. Disabled because it seems to interfere with popups
