115 lines
		
	
	
		
			3.7 KiB
		
	
	
	
		
			EmacsLisp
		
	
	
	
	
	
			
		
		
	
	
			115 lines
		
	
	
		
			3.7 KiB
		
	
	
	
		
			EmacsLisp
		
	
	
	
	
	
| ;;; init-org.el --- -*- lexical-binding: t -*-
 | |
| ;;
 | |
| ;; 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: 2.0.0
 | |
| ;; Last-Updated: Tue Dec 24 14:05:45 2019 (-0500)
 | |
| ;;           By: Mingde (Matthew) Zeng
 | |
| ;; 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 nil
 | |
|   :defer t
 | |
|   :bind
 | |
|   ("C-c l" . org-store-link)
 | |
|   ("C-c a" . org-agenda)
 | |
|   ("C-c c" . org-capture)
 | |
|   ("C-c b" . org-switch)
 | |
|   (:map org-mode-map ("C-c C-p" . org-export-as-pdf-and-open))
 | |
|   :custom
 | |
|   (org-log-done 'time)
 | |
|   (org-export-backends (quote (ascii html icalendar latex md odt)))
 | |
|   (org-use-speed-commands t)
 | |
|   (org-confirm-babel-evaluate 'nil)
 | |
|   (org-todo-keywords
 | |
|    '((sequence "TODO" "IN-PROGRESS" "REVIEW" "|" "DONE")))
 | |
|   (org-agenda-window-setup 'other-window)
 | |
|   :config
 | |
|   (unless (version< org-version "9.2")
 | |
|     (require 'org-tempo))
 | |
|   (when (file-directory-p "~/org/agenda/")
 | |
|     (setq org-agenda-files (list "~/org/agenda/")))
 | |
| 
 | |
|   (defun org-export-turn-on-syntax-highlight ()
 | |
|     "Setup variables to turn on syntax highlighting when calling `org-latex-export-to-pdf'."
 | |
|     (interactive)
 | |
|     (setq org-latex-listings 'minted
 | |
|           org-latex-packages-alist '(("" "minted"))
 | |
|           org-latex-pdf-process
 | |
|           '("pdflatex -shelnl-escape -interaction nonstopmode -output-directory %o %f"
 | |
|             "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f")))
 | |
| 
 | |
|   (defun org-export-as-pdf-and-open ()
 | |
|     "Run `org-latex-export-to-pdf', delete the tex file and open pdf in a new buffer."
 | |
|     (interactive)
 | |
|     (save-buffer)
 | |
|     (let* ((pdf-path (org-latex-export-to-pdf))
 | |
|            (pdf-name (file-name-nondirectory pdf-path)))
 | |
|       (if (try-completion pdf-name (mapcar #'buffer-name (buffer-list)))
 | |
|           (progn
 | |
|             (kill-matching-buffers (concat "^" pdf-name) t t)
 | |
|             (find-file-other-window pdf-name))
 | |
|         (find-file-other-window pdf-name))
 | |
|       (delete-file (concat (substring pdf-path 0 (string-match "[^\.]*\/?$" pdf-path)) "tex")))))
 | |
| ;; -OrgPac
 | |
| 
 | |
| ;; TocOrgPac
 | |
| (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"))
 | |
|   :config
 | |
|   (org-babel-do-load-languages
 | |
|    'org-babel-load-languages
 | |
|    '(;; other Babel languages
 | |
|      (plantuml . t))))
 | |
| ;; -PlantUMLPac
 | |
| 
 | |
| (provide 'init-org)
 | |
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 | |
| ;;; init-org.el ends here
 |