<commit_before>(use-package org
  :config
  (add-hook 'org-mode-hook 'l/org-mode-hook)
  (add-hook 'org-agenda-mode-hook 'l/org-agenda-mode-hook)
  (add-hook 'after-save-hook 'l/org-mode-save-hook)
  ; Write timestamp when a TODO changes to DONE.
  (setq org-log-done t)
  ; Write additional timestamp each time a task is re-DEADLINE-d. Useful for
  ; seeing which tasks are incurring time cost overruns.
  (setq org-log-redeadline (quote time))
  ; Write additional timestamp each time a task is re-SCHEDULED-d.
  (setq org-log-reschedule (quote time))
  ; Make agenda show 2 weeks instead of 1.
  (setq org-agenda-span 'fortnight)
  ; Mark a TODO item as DONE.
  (evil-define-key 'normal org-mode-map "T" 'org-todo)
  ; Prefer Emacs mode for agenda view, because it has so many keybindings.
  (evil-set-initial-state 'org-agenda-mode 'emacs)
  (setq org-agenda-files '("~/lo/plan.org"))

  ; Disable visual line mode for agenda view because otherwise, tags get shown on
  ; the next line because line length calculations are thrown off.
  ; https://superuser.com/a/531670
  (add-hook 'org-agenda-mode-hook
    (lambda ()
      (visual-line-mode -1)
      (toggle-truncate-lines 1)))

  ; org-agenda: Add weekly review view.
  ; https://emacs.stackexchange.com/a/8163/13006
  (setq org-agenda-custom-commands
    '(("w" "Weekly review"
      agenda ""
      (
        (org-agenda-span 'week)
        (org-agenda-start-with-log-mode '(closed clock state))
        (org-agenda-skip-function
          '(org-agenda-skip-entry-if 'nottodo 'done))))))

  ; Org-babel settings (for evaluating code blocks).
  (org-babel-do-load-languages
    'org-babel-load-languages
    '(
      (C . t)
      (clojure . t)
      (haskell . t)
      (java . t)
      (python . t)
      (shell . t)
      (sql . t)))

  ; Use cider for evaluating clojure source code blocks. This requires starting
  ; up cider first, with `M-x cider-jack-in' before doing C-c C-c.
  (setq org-babel-clojure-backend 'cider)

  ; Disable source-code evaluation prompt. The prompt is enabled by default for
  ; security reasons, but disable it because I'm not downloading other people's
  ; org-mode files and running babel on them.
  (setq org-confirm-babel-evaluate nil)

  ; Allow single/double quote marks in inline '='-delimited verbatim formatting.
  ; see https://lists.gnu.org/archive/html/emacs-orgmode/2014-04/msg00199.html
  (setq org-emphasis-regexp-components
    '(" \t('\"{" "- \t.,:!?;'\")}\\" " \t\r\n" "." 1))
  ; Do not convert TAB characters in source code blocks into spaces.
  (setq org-src-preserve-indentation t)

  ; Use Unicode bullet character for bullets and lists.
  (font-lock-add-keywords 'org-mode
    '(("^ *\\([-]\\) "
    (0 (compose-region (match-beginning 1) (match-end 1) "•")))))

  (setq org-publish-project-alist
    '(
      ("eh"
        :base-directory "~/prog/elementary-haskell/"
        :publishing-directory "~/prog/elementary-haskell/public_html"
        :publishing-function org-html-publish-to-html
        :section-numbers t
        :with-toc t
        :headline-levels 4
        :html-preamble t
        :html-head "<link rel=\"stylesheet\"
          href=\"css/style.css\"
          type=\"text/css\"/>"
      )
      ("gv"
        :base-directory "~/prog/gv/doc/"
        :publishing-directory "~/prog/gv/doc/public_html"
        :publishing-function org-html-publish-to-html
        :section-numbers t
        :with-toc t
        :headline-levels 4
        :html-preamble t
        :html-head "<link rel=\"stylesheet\"
          href=\"css/style.css\"
          type=\"text/css\"/>"
      )
      ("day"
        :base-directory "~/org/day"
        :publishing-directory "~/org/day/public_html"
        :publishing-function org-html-publish-to-html
        :section-numbers t
        :with-toc nil
        :html-preamble nil
        :html-postamble nil
        :html-head "<link rel=\"stylesheet\"
          href=\"css/style.css\"
          type=\"text/css\"/>"))))

(defun l/org-mode-hook ()
  (modify-syntax-entry ?_ "w")
  ; Disable default orgmode hotkeys that interfere with our global hotkeys
  ; defined elsewhere.
  (define-key org-mode-map [(tab)] nil)
  (define-key org-mode-map (kbd "<S-iso-lefttab>") nil)
  (define-key org-mode-map (kbd "<backtab>") nil))

(defun l/org-agenda-mode-hook ()
  ; Remap some hotkeys.
  (define-key org-agenda-mode-map "H" 'evil-next-buffer)
  (define-key org-agenda-mode-map "L" 'evil-prev-buffer)
  (define-key org-agenda-mode-map (kbd "RET") 'org-agenda-goto)
  (define-key org-agenda-mode-map [(tab)] 'other-window))

(defhydra hydra-org (:foreign-keys warn)
  "org"
  ("a" org-agenda "org-agenda" :exit t)<commit_msg>emacs: org: agenda: add keybinding for shift-TAB<commit_after>(use-package org
  :config
  (add-hook 'org-mode-hook 'l/org-mode-hook)
  (add-hook 'org-agenda-mode-hook 'l/org-agenda-mode-hook)
  (add-hook 'after-save-hook 'l/org-mode-save-hook)
  ; Write timestamp when a TODO changes to DONE.
  (setq org-log-done t)
  ; Write additional timestamp each time a task is re-DEADLINE-d. Useful for
  ; seeing which tasks are incurring time cost overruns.
  (setq org-log-redeadline (quote time))
  ; Write additional timestamp each time a task is re-SCHEDULED-d.
  (setq org-log-reschedule (quote time))
  ; Make agenda show 2 weeks instead of 1.
  (setq org-agenda-span 'fortnight)
  ; Mark a TODO item as DONE.
  (evil-define-key 'normal org-mode-map "T" 'org-todo)
  ; Prefer Emacs mode for agenda view, because it has so many keybindings.
  (evil-set-initial-state 'org-agenda-mode 'emacs)
  (setq org-agenda-files '("~/lo/plan.org"))

  ; Disable visual line mode for agenda view because otherwise, tags get shown on
  ; the next line because line length calculations are thrown off.
  ; https://superuser.com/a/531670
  (add-hook 'org-agenda-mode-hook
    (lambda ()
      (visual-line-mode -1)
      (toggle-truncate-lines 1)))

  ; org-agenda: Add weekly review view.
  ; https://emacs.stackexchange.com/a/8163/13006
  (setq org-agenda-custom-commands
    '(("w" "Weekly review"
      agenda ""
      (
        (org-agenda-span 'week)
        (org-agenda-start-with-log-mode '(closed clock state))
        (org-agenda-skip-function
          '(org-agenda-skip-entry-if 'nottodo 'done))))))

  ; Org-babel settings (for evaluating code blocks).
  (org-babel-do-load-languages
    'org-babel-load-languages
    '(
      (C . t)
      (clojure . t)
      (haskell . t)
      (java . t)
      (python . t)
      (shell . t)
      (sql . t)))

  ; Use cider for evaluating clojure source code blocks. This requires starting
  ; up cider first, with `M-x cider-jack-in' before doing C-c C-c.
  (setq org-babel-clojure-backend 'cider)

  ; Disable source-code evaluation prompt. The prompt is enabled by default for
  ; security reasons, but disable it because I'm not downloading other people's
  ; org-mode files and running babel on them.
  (setq org-confirm-babel-evaluate nil)

  ; Allow single/double quote marks in inline '='-delimited verbatim formatting.
  ; see https://lists.gnu.org/archive/html/emacs-orgmode/2014-04/msg00199.html
  (setq org-emphasis-regexp-components
    '(" \t('\"{" "- \t.,:!?;'\")}\\" " \t\r\n" "." 1))
  ; Do not convert TAB characters in source code blocks into spaces.
  (setq org-src-preserve-indentation t)

  ; Use Unicode bullet character for bullets and lists.
  (font-lock-add-keywords 'org-mode
    '(("^ *\\([-]\\) "
    (0 (compose-region (match-beginning 1) (match-end 1) "•")))))

  (setq org-publish-project-alist
    '(
      ("eh"
        :base-directory "~/prog/elementary-haskell/"
        :publishing-directory "~/prog/elementary-haskell/public_html"
        :publishing-function org-html-publish-to-html
        :section-numbers t
        :with-toc t
        :headline-levels 4
        :html-preamble t
        :html-head "<link rel=\"stylesheet\"
          href=\"css/style.css\"
          type=\"text/css\"/>"
      )
      ("gv"
        :base-directory "~/prog/gv/doc/"
        :publishing-directory "~/prog/gv/doc/public_html"
        :publishing-function org-html-publish-to-html
        :section-numbers t
        :with-toc t
        :headline-levels 4
        :html-preamble t
        :html-head "<link rel=\"stylesheet\"
          href=\"css/style.css\"
          type=\"text/css\"/>"
      )
      ("day"
        :base-directory "~/org/day"
        :publishing-directory "~/org/day/public_html"
        :publishing-function org-html-publish-to-html
        :section-numbers t
        :with-toc nil
        :html-preamble nil
        :html-postamble nil
        :html-head "<link rel=\"stylesheet\"
          href=\"css/style.css\"
          type=\"text/css\"/>"))))

(defun l/org-mode-hook ()
  (modify-syntax-entry ?_ "w")
  ; Disable default orgmode hotkeys that interfere with our global hotkeys
  ; defined elsewhere.
  (define-key org-mode-map [(tab)] nil)
  (define-key org-mode-map (kbd "<S-iso-lefttab>") nil)
  (define-key org-mode-map (kbd "<backtab>") nil))

(defun l/org-agenda-mode-hook ()
  ; Remap some hotkeys.
  (define-key org-agenda-mode-map "H" 'evil-next-buffer)
  (define-key org-agenda-mode-map "L" 'evil-prev-buffer)
  (define-key org-agenda-mode-map (kbd "RET") 'org-agenda-goto)
  (define-key org-agenda-mode-map (kbd "<S-iso-lefttab>") (lambda () (interactive) (other-window -1)))
  (define-key org-agenda-mode-map [(tab)] 'other-window))

(defhydra hydra-org (:foreign-keys warn)
  "org"
  ("a" org-agenda "org-agenda" :exit t)
{'fraction_non_alphanumeric': 0.14995787700084245, 'fraction_numerical': 0.007687447346251053, 'mean_word_length': 2.6124001521491063, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '78706', 'n_tokens_mistral': 3458, 'n_tokens_neox': 3268, 'n_words': 817}