<commit_before>;;; module-org.el --- -*- no-byte-compile: t; -*-

(defconst org-directory (expand-file-name "~/Notes/"))

(define-minor-mode evil-org-mode
  "Evil-mode bindings for org-mode."
  :init-value nil
  :lighter " !"
  :keymap (make-sparse-keymap)
  :group 'evil-org)

(add-hook 'org-load-hook 'doom|org-init t)
(add-hook 'org-load-hook 'doom|org-keybinds t)
(add-hook 'org-load-hook 'doom|org-hacks t)
(add-hook 'org-mode-hook 'doom|org-hook)

;;
(defun doom|org-hook ()
  (evil-org-mode +1)
  (visual-line-mode +1)
  (setq line-spacing 1)

  ;; If saveplace places the point in a folded position, unfold it on load
  (when (outline-invisible-p)
    (ignore-errors
      (save-excursion
        (outline-previous-visible-heading 1)
        (org-show-subtree))))

  (defun doom|org-update ()
    (when (file-exists-p buffer-file-name)
      (org-update-statistics-cookies t)))

  (add-hook 'before-save-hook 'doom|org-update nil t)
  (add-hook 'evil-insert-state-exit-hook 'doom|org-update nil t))

(defun doom|org-init ()
  (def-popup! " *Agenda Commands*"  :align below :size 30)
  (def-popup! " *Org todo*"         :align below :size 5   :noselect t)
  (def-popup! "*Calendar*"          :align below :size 0.4)
  (def-popup! "*Org Links*"         :align below :size 5)
  (def-popup! "^\\*Org Agenda.+"    :align below :size 0.4 :regexp t)
  (def-popup! "^\\*Org Src .+\\*$"  :align below :size 0.4 :select t :regexp t)
  (def-popup! "^\\*Org-Babel.*\\*$" :align below :size 0.4 :regexp t)

  (setq-default
   org-export-coding-system 'utf-8

   ;; Appearance
   org-indent-mode-turns-on-hiding-stars t
   org-adapt-indentation nil
   org-blank-before-new-entry '((heading . nil) (plain-list-item . auto))
   org-cycle-separator-lines 1
   org-cycle-include-plain-lists t
   org-ellipsis 'hs-face
   org-entities-user '(("flat" "\\flat" nil "" "" "266D" "♭")
                       ("sharp" "\\sharp" nil "" "" "266F" "♯"))
   org-fontify-done-headline t
   org-fontify-quote-and-verse-blocks t
   org-fontify-whole-heading-line t
   org-footnote-auto-label 'plain
   org-hide-emphasis-markers t
   org-hide-leading-stars t
   org-image-actual-width nil
   org-indent-indentation-per-level 2
   org-pretty-entities t
   org-pretty-entities-include-sub-superscripts t
   org-startup-folded t
   org-startup-indented t
   org-startup-with-inline-images nil
   org-tags-column 0
   org-use-sub-superscripts '{}

   ;; Behavior
   org-catch-invisible-edits 'show
   org-checkbox-hierarchical-statistics nil
   org-completion-use-ido nil ; Use ivy/counsel for refiling
   org-confirm-elisp-link-function nil
   org-default-priority ?C
   org-hidden-keywords '(title)
   org-hierarchical-todo-statistics t
   org-log-done t
   org-loop-over-headlines-in-active-region t
   org-outline-path-complete-in-steps nil
   org-refile-use-outline-path t
   org-special-ctrl-a/e t

   ;; Sorting/refiling
   org-archive-location (concat org-directory "/archived/%s::")
   org-refile-targets '((nil . (:maxlevel . 2))) ; display full path in refile completion

   ;; Agenda
   org-agenda-restore-windows-after-quit nil
   org-agenda-skip-unavailable-files nil
   org-agenda-dim-blocked-tasks nil
   org-agenda-window-setup 'other-frame ; to get org-agenda to behave with shackle...
   org-agenda-inhibit-startup t
   org-agenda-files (append (f-entries org-directory (lambda (path) (f-ext? path "org")))
                            (f-entries (f-expand "projects" org-directory) (lambda (path) (f-ext? path "org")))
                            (f-entries (f-expand "contacts" org-directory) (lambda (path) (f-ext? path "org"))))
   org-todo-keywords '((sequence "[ ](t)" "[-](p)" "[?](m)" "|" "[X](d)")
                       (sequence "TODO(T)" "|" "DONE(D)")
                       (sequence "IDEA(i)" "NEXT(n)" "ACTIVE(a)" "WAITING(w)" "LATER(l)" "|" "CANCELLED(c)"))


   ;; Babel
   org-confirm-babel-evaluate nil   ; you don't need my permission
   org-src-fontify-natively t       ; make code pretty
   org-src-preserve-indentation t
   org-src-tab-acts-natively t
   org-src-window-setup 'current-window
   org-edit-src-content-indentation 0

   ;; Latex
   org-format-latex-options (plist-put org-format-latex-options :scale 1.4)
   org-highlight-latex-and-related '(latex)
   org-latex-create-formula-image-program 'dvipng
   org-latex-image-default-width ".9\\linewidth"
   org-latex-preview-ltxpng-directory (concat doom-temp-dir "/ltxpng/")
   org-latex-remove-logfiles nil
   org-startup-with-latex-preview nil
   ;; org-latex-packages-alist
   ;; '(("" "gauss" t)
   ;;   ("" "physics" t) TODO Install this)
   )

  (org-babel-do-load-languages
   'org-babel-load-languages
   '((python . t) (ruby . t) (sh . t) (js . t) (css . t)
     (plantuml . t) (emacs-lisp . t) (matlab . t)
     (latex . t) (calc . t) (lisp . t) (lilypond . t)
     ;; (go . t)
     ;; (http . t)
     ;; (rust . t)
     ))<commit_msg>org: match latex preview bg to doom-theme bg<commit_after>;;; module-org.el --- -*- no-byte-compile: t; -*-

(defconst org-directory (expand-file-name "~/Notes/"))

(define-minor-mode evil-org-mode
  "Evil-mode bindings for org-mode."
  :init-value nil
  :lighter " !"
  :keymap (make-sparse-keymap)
  :group 'evil-org)

(add-hook 'org-load-hook 'doom|org-init t)
(add-hook 'org-load-hook 'doom|org-keybinds t)
(add-hook 'org-load-hook 'doom|org-hacks t)
(add-hook 'org-mode-hook 'doom|org-hook)

;;
(defun doom|org-hook ()
  (evil-org-mode +1)
  (visual-line-mode +1)
  (setq line-spacing 1)

  ;; If saveplace places the point in a folded position, unfold it on load
  (when (outline-invisible-p)
    (ignore-errors
      (save-excursion
        (outline-previous-visible-heading 1)
        (org-show-subtree))))

  (defun doom|org-update ()
    (when (file-exists-p buffer-file-name)
      (org-update-statistics-cookies t)))

  (add-hook 'before-save-hook 'doom|org-update nil t)
  (add-hook 'evil-insert-state-exit-hook 'doom|org-update nil t))

(defun doom|org-init ()
  (def-popup! " *Agenda Commands*"  :align below :size 30)
  (def-popup! " *Org todo*"         :align below :size 5   :noselect t)
  (def-popup! "*Calendar*"          :align below :size 0.4)
  (def-popup! "*Org Links*"         :align below :size 5)
  (def-popup! "^\\*Org Agenda.+"    :align below :size 0.4 :regexp t)
  (def-popup! "^\\*Org Src .+\\*$"  :align below :size 0.4 :select t :regexp t)
  (def-popup! "^\\*Org-Babel.*\\*$" :align below :size 0.4 :regexp t)

  (setq-default
   org-export-coding-system 'utf-8

   ;; Appearance
   org-indent-mode-turns-on-hiding-stars t
   org-adapt-indentation nil
   org-blank-before-new-entry '((heading . nil) (plain-list-item . auto))
   org-cycle-separator-lines 1
   org-cycle-include-plain-lists t
   org-ellipsis 'hs-face
   org-entities-user '(("flat" "\\flat" nil "" "" "266D" "♭")
                       ("sharp" "\\sharp" nil "" "" "266F" "♯"))
   org-fontify-done-headline t
   org-fontify-quote-and-verse-blocks t
   org-fontify-whole-heading-line t
   org-footnote-auto-label 'plain
   org-hide-emphasis-markers t
   org-hide-leading-stars t
   org-image-actual-width nil
   org-indent-indentation-per-level 2
   org-pretty-entities t
   org-pretty-entities-include-sub-superscripts t
   org-startup-folded t
   org-startup-indented t
   org-startup-with-inline-images nil
   org-tags-column 0
   org-use-sub-superscripts '{}

   ;; Behavior
   org-catch-invisible-edits 'show
   org-checkbox-hierarchical-statistics nil
   org-completion-use-ido nil ; Use ivy/counsel for refiling
   org-confirm-elisp-link-function nil
   org-default-priority ?C
   org-hidden-keywords '(title)
   org-hierarchical-todo-statistics t
   org-log-done t
   org-loop-over-headlines-in-active-region t
   org-outline-path-complete-in-steps nil
   org-refile-use-outline-path t
   org-special-ctrl-a/e t

   ;; Sorting/refiling
   org-archive-location (concat org-directory "/archived/%s::")
   org-refile-targets '((nil . (:maxlevel . 2))) ; display full path in refile completion

   ;; Agenda
   org-agenda-restore-windows-after-quit nil
   org-agenda-skip-unavailable-files nil
   org-agenda-dim-blocked-tasks nil
   org-agenda-window-setup 'other-frame ; to get org-agenda to behave with shackle...
   org-agenda-inhibit-startup t
   org-agenda-files (append (f-entries org-directory (lambda (path) (f-ext? path "org")))
                            (f-entries (f-expand "projects" org-directory) (lambda (path) (f-ext? path "org")))
                            (f-entries (f-expand "contacts" org-directory) (lambda (path) (f-ext? path "org"))))
   org-todo-keywords '((sequence "[ ](t)" "[-](p)" "[?](m)" "|" "[X](d)")
                       (sequence "TODO(T)" "|" "DONE(D)")
                       (sequence "IDEA(i)" "NEXT(n)" "ACTIVE(a)" "WAITING(w)" "LATER(l)" "|" "CANCELLED(c)"))


   ;; Babel
   org-confirm-babel-evaluate nil   ; you don't need my permission
   org-src-fontify-natively t       ; make code pretty
   org-src-preserve-indentation t
   org-src-tab-acts-natively t
   org-src-window-setup 'current-window
   org-edit-src-content-indentation 0

   ;; Latex
   org-format-latex-options (plist-put org-format-latex-options :scale 1.5)
   org-format-latex-options (plist-put org-format-latex-options :background (face-attribute 'doom-default :background nil t))
   org-highlight-latex-and-related '(latex)
   org-latex-create-formula-image-program 'dvipng
   org-latex-image-default-width ".9\\linewidth"
   org-latex-preview-ltxpng-directory (concat doom-temp-dir "/ltxpng/")
   org-latex-remove-logfiles nil
   org-startup-with-latex-preview nil
   ;; org-latex-packages-alist
   ;; '(("" "gauss" t)
   ;;   ("" "physics" t) TODO Install this)
   )

  (org-babel-do-load-languages
   'org-babel-load-languages
   '((python . t) (ruby . t) (sh . t) (js . t) (css . t)
     (plantuml . t) (emacs-lisp . t) (matlab . t)
     (latex . t) (calc . t) (lisp . t) (lilypond . t)
     ;; (go . t)
     ;; (http . t)
     ;; (rust . t)
     ))
{'fraction_non_alphanumeric': 0.16731712198538978, 'fraction_numerical': 0.006204343040128089, 'mean_word_length': 2.7656367746797286, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4586990', 'n_tokens_mistral': 3910, 'n_tokens_neox': 3704, 'n_words': 788}