      (R          . t)
      (matlab     . t)
      (julia      . t)
-     (sh         . t)
+     (shell      . t)
      (ruby       . t)
      (python     . t)
      (haskell    . t)))
   (add-to-list 'org-src-lang-modes '("c" . c))
   (add-to-list 'org-src-lang-modes '("r" . ess-mode))
   (add-to-list 'org-src-lang-modes '("h" . haskell))
-  (add-to-list 'org-src-lang-modes '("s" . sh))
+  (add-to-list 'org-src-lang-modes '("s" . shell))
   (add-to-list 'org-src-lang-modes '("p" . python))
   (add-to-list 'org-src-lang-modes '("ruby" . enh-ruby))
   (setq org-src-fontify-natively t)
   (setq org-confirm-babel-evaluate nil))
-
-(use-package ag                         ; ag search
-  :ensure t
-  :commands (ag helm-do-grep-ag)
-  :config
-  (setq ag-highlight-search t)
-  )
-(use-package wgrep-ag                   ; Wgrep for ag
-  :ensure t
-  :defer t
-  :config
-  (add-hook 'ag-mode-hook 'wgrep-ag-setup))
 
 
 ;; smart-compile

                 "* MEETING with %? :MEETING:\n%U" :clock-in t :clock-resume t)
                ("h" "Habit" entry (file "~/Dropbox/notes/scratch.org")
                 "* NEXT %?\n%U\n%a\nSCHEDULED: %(format-time-string \"%<<%Y-%m-%d %a .+1d/3d>>\")\n:PROPERTIES:\n:STYLE: habit\n:REPEAT_TO_STATE: NEXT\n:END:\n"))))
  (use-package ox-reveal
               :defer t)
  (use-package org-pdfview
    :ensure t
    :defer t)

  :commands (dactyl-mode))


;; ;; Automatic Math preview toggle in org-mode
;; ;; Source: http://goo.gl/WLYzxp
;; (defvar org-latex-fragment-last nil
;;   "Holds last fragment/environment you were on.")
;; ;; FIXME Pretty janky right now
;; (defun org-latex-fragment-toggle ()
;;   "Toggle a latex fragment image "
;;   (and (eq 'org-mode major-mode)
;;        (let* ((el (org-element-context))
;;               (el-type (car el)))
;;          (cond
;;           ;; were on a fragment and now on a new fragment
;;           ((and
;;             ;; fragment we were on
;;             org-latex-fragment-last
;;             ;; and are on a fragment now
;;             (or
;;              (eq 'latex-fragment el-type)
;;              (eq 'latex-environment el-type))
;;             ;; but not on the last one this is a little tricky. as you edit the
;;             ;; fragment, it is not equal to the last one. We use the begin
;;             ;; property which is less likely to change for the comparison.
;;             (not (= (org-element-property :begin el)
;;                     (org-element-property :begin org-latex-fragment-last))))
;;            ;; go back to last one and put image back
;;            (save-excursion
;;              (goto-char (org-element-property :begin org-latex-fragment-last))
;;              (org-preview-latex-fragment))
;;            ;; now remove current image
;;            (goto-char (org-element-property :begin el))
;;            (let ((ov (loop for ov in (org--list-latex-overlays)
;;                            if
;;                            (and
;;                             (<= (overlay-start ov) (point))
;;                             (>= (overlay-end ov) (point)))
;;                            return ov)))
;;              (when ov
;;                (delete-overlay ov)))
;;            ;; and save new fragment
;;            (setq org-latex-fragment-last el))

;;           ;; were on a fragment and now are not on a fragment
;;           ((and
;;             ;; not on a fragment now
;;             (not (or
;;                   (eq 'latex-fragment el-type)
;;                   (eq 'latex-environment el-type)))
;;             ;; but we were on one
;;             org-latex-fragment-last)
;;            ;; put image back on
;;            (save-excursion
;;              (goto-char (org-element-property :begin org-latex-fragment-last))
;;              (org-preview-latex-fragment))
;;            ;; unset last fragment
;;            (setq org-latex-fragment-last nil))

;;           ;; were not on a fragment, and now are
;;           ((and
;;             ;; we were not one one
;;             (not org-latex-fragment-last)
;;             ;; but now we are
;;             (or
;;              (eq 'latex-fragment el-type)
;;              (eq 'latex-environment el-type)))
;;            (goto-char (org-element-property :begin el))
;;            ;; remove image
;;            (let ((ov (loop for ov in (org--list-latex-overlays)
;;                            if
;;                            (and
;;                             (<= (overlay-start ov) (point))
;;                             (>= (overlay-end ov) (point)))
;;                            return ov)))
;;              (when ov
;;                (delete-overlay ov)))
;;            (setq org-latex-fragment-last el))))))
;; (add-hook 'post-command-hook 'org-latex-fragment-toggle)
;; bigger latex fragment
(setq org-format-latex-options (quote (:foreground default :background default :scale 2.0 :html-foreground "Black" :html-background "Transparent" :html-scale 2.0 :matchers ("begin" "$1" "$" "$$" "\\(" "\\["))))

