237 lines
8.2 KiB
EmacsLisp
237 lines
8.2 KiB
EmacsLisp
;; -*- lexical-binding: t; -*-
|
|
;;; init-org.el --- org initialization
|
|
;;
|
|
;; Filename: init-org.el
|
|
;; Description: Initialize Org, Toc-org, HTMLize, OX-GFM
|
|
;; Author: Mingde (Matthew) Zeng
|
|
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
|
;; Created: Fri Mar 15 11:09:30 2019 (-0400)
|
|
;; Version: 3.0
|
|
;; URL: https://github.com/MatthewZMD/.emacs.d
|
|
;; Keywords: M-EMACS .emacs.d org toc-org htmlize ox-gfm
|
|
;; Compatibility: emacs-version >= 26.1
|
|
;;
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
;;
|
|
;;; Commentary:
|
|
;;
|
|
;; This initializes org toc-org htmlize ox-gfm
|
|
;;
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
;;
|
|
;; This program is free software: you can redistribute it and/or modify
|
|
;; it under the terms of the GNU General Public License as published by
|
|
;; the Free Software Foundation, either version 3 of the License, or (at
|
|
;; your option) any later version.
|
|
;;
|
|
;; This program is distributed in the hope that it will be useful, but
|
|
;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
;; General Public License for more details.
|
|
;;
|
|
;; You should have received a copy of the GNU General Public License
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
|
;;
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
;;
|
|
;;; Code:
|
|
|
|
;; OrgPac
|
|
(use-package org
|
|
:ensure t
|
|
;; :defer t
|
|
:bind (("C-c l" . org-store-link)
|
|
("C-c a" . org-agenda)
|
|
("C-c c" . org-capture)
|
|
(:map org-mode-map (("C-c C-p" . eaf-org-export-to-pdf-and-open)
|
|
("C-c ;" . nil)
|
|
("C-c C-." . org-time-stamp-inactive)
|
|
)))
|
|
:custom
|
|
(org-directory "~/Documents/Org-mode/")
|
|
(org-default-notes-file (concat org-directory "/agenda/notes.org"))
|
|
(org-log-done 'time)
|
|
(calendar-latitude 43.65107) ;; Prerequisite: set it to your location, currently default: Toronto, Canada
|
|
(calendar-longitude -79.347015) ;; Usable for M-x `sunrise-sunset' or in `org-agenda'
|
|
(org-export-backends (quote (ascii html icalendar latex md odt)))
|
|
(org-use-speed-commands t)
|
|
(org-confirm-babel-evaluate 'nil)
|
|
(org-latex-listings-options '(("breaklines" "true")))
|
|
(org-latex-listings 'minted)
|
|
(org-latex-src-block-backend 'minted)
|
|
(org-export-with-LaTeX-fragments t)
|
|
(org-deadline-warning-days 7)
|
|
(org-todo-keywords
|
|
'((sequence "TODO(t)" "IN-PROGRESS(p)" "REVIEW(r)" "PAUSED" "|" "DONE(d)" "CANCELED(c@)")
|
|
(sequence "ISSUE(i)" "BUG(b)" "KNOWN(k)" "|" "FIXED(f)")))
|
|
(org-todo-keyword-faces '(("TODO" . "red")
|
|
("DONE" . "green")
|
|
("IN-PROGRESS" . "lightblue")
|
|
("REVIEW" . "magenta")
|
|
("PAUSED" . "magenta")
|
|
("CANCELED" . "gray")
|
|
("ISSUE" . "red")
|
|
("BUG" . "orange")
|
|
("KNOWN" . "yellow")
|
|
("FIXED" . "green")))
|
|
(org-agenda-window-setup 'other-window)
|
|
(org-startup-indented t)
|
|
(org-latex-pdf-process
|
|
'("lualatex -shell-escape -interaction nonstopmode -output-directory %o %f"
|
|
"lualatex -shell-escape -interaction nonstopmode -output-directory %o %f"))
|
|
(add-to-list 'org-latex-classes
|
|
'("intemo-report"
|
|
"\\documentclass[a4paper,oneside]{intemo-org-report}
|
|
[NO-DEFAULT-PACKAGES]
|
|
[PACKAGES]
|
|
[EXTRA]"
|
|
("\\chapter{%s}" . "\\chapter*{%s}")
|
|
("\\section{%s}" . "\\section*{%s}")
|
|
("\\subsection{%s}" . "\\subsection*{%s}")
|
|
("\\subsubsection{%s}" . "\\subsubsection*{%s}")))
|
|
|
|
(add-to-list 'org-latex-classes
|
|
'("intemo-article"
|
|
"\\documentclass[a4paper,oneside]{intemo-org-article}
|
|
[NO-DEFAULT-PACKAGES]
|
|
[PACKAGES]
|
|
[EXTRA]"
|
|
("\\section{%s}" . "\\chapter*{%s}")
|
|
("\\subsection{%s}" . "\\section*{%s}")
|
|
("\\subsubsection{%s}" . "\\subsection*{%s}")
|
|
)
|
|
)
|
|
:custom-face
|
|
(org-agenda-current-time ((t (:foreground "spring green"))))
|
|
:config
|
|
(add-to-list 'org-latex-packages-alist '("" "listings"))
|
|
(unless (version< org-version "9.2")
|
|
(require 'org-tempo))
|
|
(setq org-agenda-files (list (concat org-directory "agenda/")))
|
|
(org-babel-do-load-languages
|
|
'org-babel-load-languages
|
|
'(;; other Babel languages
|
|
(C . t)
|
|
(python . t)
|
|
(plantuml . t)))
|
|
(defun org-export-toggle-syntax-highlight ()
|
|
"Setup variables to turn on syntax highlighting when calling `org-latex-export-to-pdf'."
|
|
(interactive)
|
|
(setq-local org-latex-listings 'minted)
|
|
(add-to-list 'org-latex-packages-alist '("newfloat" "minted")))
|
|
|
|
(defun org-table-insert-vertical-hline ()
|
|
"Insert a #+attr_latex to the current buffer, default the align to |c|c|c|, adjust if necessary."
|
|
(interactive)
|
|
(insert "#+attr_latex: :align |c|c|c|"))
|
|
|
|
;; Modify export direcotry
|
|
(defun org-export-output-file-name-modified (orig-fun extension &optional subtreep pub-dir)
|
|
(unless pub-dir
|
|
(setq pub-dir "org-exported")
|
|
(unless (file-directory-p pub-dir)
|
|
(make-directory pub-dir)))
|
|
(apply orig-fun extension subtreep pub-dir nil))
|
|
(advice-add 'org-export-output-file-name :around #'org-export-output-file-name-modified)
|
|
|
|
(setq org-capture-templates
|
|
'(("t" "Personal todo" entry
|
|
(file+headline +org-capture-todo-file "Inbox")
|
|
"* TODO %? :@general:" :prepend t)
|
|
|
|
("f" "Empty" entry
|
|
(file+headline +org-capture-todo-file "Inbox")
|
|
"* TODO %?" :prepend t)
|
|
|
|
("w" "WATCH" entry
|
|
(file+headline +org-capture-todo-file "Inbox")
|
|
"* TODO %? :@watch:" :prepend t)
|
|
|
|
("r" "READ" entry
|
|
(file+headline +org-capture-todo-file "Inbox")
|
|
"* TODO %? :@read:" :prepend t)
|
|
|
|
("c" "CHECK" entry
|
|
(file+headline +org-capture-todo-file "Inbox")
|
|
"* TODO %? :@check:" :prepend t)
|
|
|
|
("i" "Got a new idea?" entry
|
|
(file+headline +org-capture-todo-file "Inbox")
|
|
"* TODO %? :@idea:" :prepend t)
|
|
|
|
("j" "Journal" entry
|
|
(file+headline +org-capture-journal-file "Posts")
|
|
"*** %?\n:DATE:\n%<[%Y-%m-%d %a %H:%M]>\n:END:" :prepend t)))
|
|
|
|
(setq org-agenda-custom-commands
|
|
'(
|
|
("f" "Today Tasks"
|
|
(
|
|
(agenda "" ((org-agenda-span 4)))
|
|
(org-ql-block '(and
|
|
(todo "TODO")
|
|
(or (scheduled)
|
|
(deadline)))
|
|
((org-ql-block-header "Soon")))
|
|
))
|
|
|
|
("v" "General Tasks"
|
|
(
|
|
(agenda "" ((org-agenda-span 4)))
|
|
(org-ql-block '(and
|
|
(priority "A")
|
|
(not (deadline))
|
|
(not (scheduled)))
|
|
((org-ql-block-header "High-priority tasks")))
|
|
|
|
(org-ql-block '(and
|
|
(todo "TODO")
|
|
(tags "@idea")
|
|
(not (tags "@later"))
|
|
(not (deadline))
|
|
(not (scheduled)))
|
|
((org-ql-block-header "Looking for an idea?")))
|
|
|
|
(org-ql-block '(and
|
|
(todo "TODO")
|
|
(tags "@write")
|
|
(not (tags "@later"))
|
|
(not (tags "project"))
|
|
(not (deadline))
|
|
(not (scheduled)))
|
|
((org-ql-block-header "Write something:")))
|
|
|
|
(org-roam-ql-agenda-block '(and (todo "TODO")))
|
|
))))
|
|
)
|
|
;; -OrgPac
|
|
|
|
(use-package toc-org
|
|
:hook (org-mode . toc-org-mode))
|
|
;; -TocOrgPac
|
|
|
|
;; HTMLIZEPac
|
|
(use-package htmlize :defer t)
|
|
;; -HTMLIZEPac
|
|
|
|
;; OXGFMPac
|
|
(use-package ox-gfm :defer t)
|
|
;; -OXGFMPac
|
|
|
|
;; PlantUMLPac
|
|
(use-package plantuml-mode
|
|
:defer t
|
|
:custom
|
|
(org-plantuml-jar-path (expand-file-name "~/tools/plantuml/plantuml.jar")))
|
|
;; -PlantUMLPac
|
|
|
|
;; Org-ql
|
|
(use-package org-ql
|
|
:defer t
|
|
)
|
|
;; -Org-ql
|
|
|
|
(provide 'init-org)
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
;;; init-org.el ends here
|