Files
emacs/settings/my-settings.el

97 lines
3.7 KiB
EmacsLisp

;;; my-settings.el --- Summary -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:
(use-package my
:config
(with-eval-after-load 'org
(add-hook 'org-mode-hook 'my-org-link-color-hook)
(add-hook 'org-ctrl-c-ctrl-c-hook 'my-org-table-cell-color-attr)))
(use-package my-org-article
:after (org)
:config
;; HTML
(defun my-org-article-html-export-to-html-notify (&optional async subtreep visible-only body-only ext-plist)
"HTML article export.
Extended `my-org-article-html-export-to-html' with an additional
notification."
(interactive)
(let* ((extension (concat
(when (> (length org-html-extension) 0) ".")
(or (plist-get ext-plist :html-extension)
org-html-extension
"html")))
(file (org-export-output-file-name extension subtreep))
;; need to bind this because tufte treats footnotes specially, so we
;; don't want to display them at the bottom
(org-html-footnotes-section (if org-tufte-include-footnotes-at-bottom
org-html-footnotes-section
"<!-- %s --><!-- %s -->")))
(org-export-to-file 'article-html file async subtreep
visible-only body-only ext-plist
(lambda (file) ;; is called with FILE and has to return a file name.
(progn
(when my-dbusp
(use-package notifications)
(notifications-notify
:title "Emacs Org Article HTML Export"
:body "Export <b>done</b>."
:timeout 60000
:urgency 'normal
:category "transfer"))
file))))) ;; is needed for the asynchronous task
(defun my-org-article-html-export-to-html-notify-async ()
"HTML article async export.
Run `my-org-article-html-export-to-html' async and kill gnuplot
buffer. See also async init file `org-export-async-init-file'."
(interactive)
(save-buffer)
(when (get-buffer "*gnuplot*")
(kill-buffer "*gnuplot*")) ;; to get a new session
(my-org-article-html-export-to-html-notify t))
(org-defkey org-mode-map [f5] 'my-org-article-html-export-to-html-notify-async)
;; LaTeX
(defun my-org-article-latex-export-to-pdf-notify
(&optional async subtreep visible-only body-only ext-plist)
"LaTeX article export.
Extended `my-org-article-latex-export-to-pdf' with an additional
notification."
(interactive)
(let ((outfile (org-export-output-file-name ".tex" subtreep)))
(org-export-to-file 'article-latex outfile
async subtreep visible-only body-only ext-plist
(lambda (file) ;; is called with FILE and has to return a file name.
(let ((output (org-latex-compile file)))
(when my-dbusp
(use-package notifications)
(notifications-notify
:title "Emacs Org Article Latex Export to PDF"
:body "Export <b>done</b>."
:timeout 60000
:urgency 'normal
:category "transfer"))
output))))) ;; is needed for the asynchronous task
(defun my-org-article-latex-export-to-pdf-notify-async ()
"LaTeX article async export.
Run `my-org-article-latex-export-to-pdf-notify' async and kill
gnuplot buffer. See also async init file
`org-export-async-init-file'."
(interactive)
(save-buffer)
(when (get-buffer "*gnuplot*")
(kill-buffer "*gnuplot*")) ;; to get a new session
(my-org-article-latex-export-to-pdf-notify t))
(org-defkey org-mode-map [f6] 'my-org-article-latex-export-to-pdf-notify-async)
)
(use-package my-org-letter
:after (org))
(provide 'my-settings)
;;; my-settings.el ends here