<commit_before>;; -*- lexical-binding: t -*-

(defconst my-org-packages '(fontawesome
                            helm-orgcard
                            org
                            org-sidebar
                            org-trello
                            ox-gfm
                            plantuml-mode
                            poporg
                            side-notes))

(defun my-org/init-fontawesome ()
  (use-package fontawesome
    :defer t
    :init
    (spacemacs/safe-set-leader-keys "if" #'helm-fontawesome)))

(defun my-org/init-helm-orgcard ()
  (use-package helm-orgcard
    :defer t
    :init
    (spacemacs/safe-set-leader-keys-for-major-mode 'org-mode
      "?" #'helm-orgcard)))

(defun my-org/post-init-org ()
  ;; share org files over Syncthing.
  (setq org-directory "~/Sync/org/")

  ;; Spacemacs sets this before knowing our value for `org-directory',
  ;; therefore we are correcting it here.
  (setq org-default-notes-file (expand-file-name "notes.org" org-directory))

  ;; automatically indent org sections.
  (setq org-startup-indented t)

  ;; set up agendas.
  (setq org-agenda-files (list (concat org-directory "agenda/"))
        org-outline-path-complete-in-steps nil
        org-refile-allow-creating-parent-nodes 'confirm
        org-refile-targets '((org-agenda-files :maxlevel . 2))
        org-refile-use-outline-path 'file)

  (setq org-use-sub-superscripts '{}
        org-export-with-sub-superscripts '{})

  (setq org-hide-emphasis-markers t
        org-pretty-entities t)

  ;; Warn about editing an invisible (folded) area.
  (setq org-catch-invisible-edits 'show-and-error)

  ;; customize org source block editing.
  (setq org-src-window-setup 'current-window
        org-src-preserve-indentation t)

  ;; customize org priority faces.
  (add-hook 'spacemacs-post-theme-change-hook
            #'my-org//adjust-org-priority-faces)
  (my-org//adjust-org-priority-faces)

  ;; Wrap long lines by default.
  (add-hook 'org-mode-hook #'spacemacs/toggle-visual-line-navigation-on)

  ;; TODO: https://emacs.stackexchange.com/questions/20574/default-inline-image-background-in-org-mode?rq=1

  ;; TODO: ob-blockdiag: --no-transparency --antialias -T (type)

  ;; additional leader key bindings for org functionality.
  (spacemacs/safe-set-leader-keys-for-major-mode 'org-mode
    "oy" #'org-copy-special
    "oc" #'org-cut-special
    "op" #'org-paste-special)

  ;; ditaa converts ascii images to real images.
  (with-eval-after-load 'org
    (push '(ditaa . t) org-babel-load-languages)
    (setq org-ditaa-jar-path "/usr/share/ditaa/ditaa.jar"))

  ;; calc for evaluating formulas
  (with-eval-after-load 'org
    (push '(calc . t) org-babel-load-languages))

  ;; configure org-download.
  (setq org-download-heading-lvl nil)

  ;; extra keybindings for org functionality.
  (spacemacs/declare-prefix "oo" "org")
  (spacemacs/safe-set-leader-keys
    "ooa" #'my-org/org-agenda
    "oob" #'my-org/org-backlog
    "ooi" #'my-org/org-index)
  (spacemacs/safe-set-leader-keys-for-major-mode 'org-mode
    "or" #'org-redisplay-inline-images
    "oe" #'counsel-org-entity)

  (advice-add 'er/expand-region :around
              #'my-org//ad-preserve-outline-visibility)

  ;; Automatically redisplay inline images.
  (add-hook 'org-babel-after-execute-hook #'org-display-inline-images))

(defun my-org/post-init-org-trello ()
  (setq org-trello-input-completion-mechanism 'helm)
  (with-eval-after-load 'org-trello
    (setq orgtrello-log-level orgtrello-log-warn)))

(defun my-org/init-org-sidebar ()
  (use-package org-sidebar
    :defer t))

(defun my-org/post-init-ox-gfm ()
  (el-patch-feature ox-gfm)
  (with-eval-after-load 'ox-gfm
    (defvar org-gfm-src-lang-overrides '(("conf-javaprop" . "properties"))
      "An association list that maps language names as specified in the first<commit_msg>Improve comments in org layer<commit_after>;; -*- lexical-binding: t -*-

(defconst my-org-packages '(fontawesome
                            helm-orgcard
                            org
                            org-sidebar
                            org-trello
                            ox-gfm
                            plantuml-mode
                            poporg
                            side-notes))

(defun my-org/init-fontawesome ()
  (use-package fontawesome
    :defer t
    :init
    (spacemacs/safe-set-leader-keys "if" #'helm-fontawesome)))

(defun my-org/init-helm-orgcard ()
  (use-package helm-orgcard
    :defer t
    :init
    (spacemacs/safe-set-leader-keys-for-major-mode 'org-mode
      "?" #'helm-orgcard)))

(defun my-org/post-init-org ()
  ;; Share org files over Syncthing.
  (setq org-directory "~/Sync/org/")

  ;; Spacemacs sets this before knowing our value for `org-directory',
  ;; therefore we are correcting it here.
  (setq org-default-notes-file (expand-file-name "notes.org" org-directory))

  ;; Automatically indent org sections.
  (setq org-startup-indented t)

  ;; Set up agendas and refiling.
  (setq org-agenda-files (list (concat org-directory "agenda/"))
        org-outline-path-complete-in-steps nil
        org-refile-allow-creating-parent-nodes 'confirm
        org-refile-targets '((org-agenda-files :maxlevel . 2))
        org-refile-use-outline-path 'file)

  ;; Mandate that sub- and superscripts have to be wrapped in curly braces to be
  ;; interpreted as such (eg. a_{1}, 2^{2}). Without this, it often happens that
  ;; words with underscores (eg. variable/function names) get interpreted as an
  ;; expression with subscripts when they are not.
  (setq org-use-sub-superscripts '{}
        org-export-with-sub-superscripts '{})

  ;; Make org documents more WYSIWYG-alike.
  (setq org-hide-emphasis-markers t
        org-pretty-entities t)

  ;; Warn about editing an invisible (folded) area.
  (setq org-catch-invisible-edits 'show-and-error)

  ;; Customize org source block editing.
  (setq org-src-window-setup 'current-window
        org-src-preserve-indentation t)

  ;; Customize org priority faces.
  (add-hook 'spacemacs-post-theme-change-hook #'my-org//adjust-org-priority-faces)
  (my-org//adjust-org-priority-faces)

  ;; Wrap long lines by default.
  (add-hook 'org-mode-hook #'spacemacs/toggle-visual-line-navigation-on)

  ;; TODO: https://emacs.stackexchange.com/questions/20574/default-inline-image-background-in-org-mode?rq=1

  ;; TODO: ob-blockdiag: --no-transparency --antialias -T (type)

  ;; additional leader key bindings for org functionality.
  (spacemacs/safe-set-leader-keys-for-major-mode 'org-mode
    "oy" #'org-copy-special
    "oc" #'org-cut-special
    "op" #'org-paste-special)

  ;; Integrate ditaa converts ascii images to real images.
  (with-eval-after-load 'org
    (push '(ditaa . t) org-babel-load-languages)
    (setq org-ditaa-jar-path "/usr/share/ditaa/ditaa.jar"))

  ;; Enable `calc' for evaluating formulas.
  (with-eval-after-load 'org
    (push '(calc . t) org-babel-load-languages))

  ;; Customize `org-download'.
  (setq org-download-heading-lvl nil)

  ;; Extra keybindings for org functionality.
  (spacemacs/declare-prefix "oo" "org")
  (spacemacs/safe-set-leader-keys
    "ooa" #'my-org/org-agenda
    "oob" #'my-org/org-backlog
    "ooi" #'my-org/org-index)
  (spacemacs/safe-set-leader-keys-for-major-mode 'org-mode
    "or" #'org-redisplay-inline-images
    "oe" #'counsel-org-entity)

  ;; Prevent `expand-region' from altering outline visibility while trying to
  ;; find an expansion of the selection.
  (advice-add 'er/expand-region :around #'my-org//ad-preserve-outline-visibility)

  ;; Automatically redisplay inline images.
  (add-hook 'org-babel-after-execute-hook #'org-display-inline-images))

(defun my-org/post-init-org-trello ()
  (setq org-trello-input-completion-mechanism 'helm)
  (with-eval-after-load 'org-trello
    (setq orgtrello-log-level orgtrello-log-warn)))

(defun my-org/init-org-sidebar ()
  (use-package org-sidebar
    :defer t))

(defun my-org/post-init-ox-gfm ()
  (el-patch-feature ox-gfm)
  (with-eval-after-load 'ox-gfm
    (defvar org-gfm-src-lang-overrides '(("conf-javaprop" . "properties"))
      "An association list that maps language names as specified in the first
{'fraction_non_alphanumeric': 0.14001707525307963, 'fraction_numerical': 0.0020734235882424686, 'mean_word_length': 2.6444444444444444, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1327832', 'n_tokens_mistral': 2983, 'n_tokens_neox': 2815, 'n_words': 586}