diff --git a/lisp/my/my-org-article.el b/lisp/my/my-org-article.el index 851e7c57..b9d01835 100644 --- a/lisp/my/my-org-article.el +++ b/lisp/my/my-org-article.el @@ -33,6 +33,8 @@ (require 'ob-gnuplot) (require 'ox-latex) (require 'ox-tufte) +(require 'org) +(require 'org-ref) ;; `org-ref-acronyms-before-parsing' and to find `cite:...' in the org file. ;; add to generel org variabels, so that it works also for babel latex src blocks (add-to-list 'org-babel-latex-htlatex-packages "{pgfplots}" t) diff --git a/lisp/my/my.el b/lisp/my/my.el index 054fa986..40cf9638 100644 --- a/lisp/my/my.el +++ b/lisp/my/my.el @@ -92,8 +92,9 @@ - =\\%= and =\\%%= can also be used for HTML SVG export *Export* [[elisp:(my-org-article-help)][Article help]] - [[help:org-html-export-to-html][HTML]] ............... C-c C-e h h [[help:org-latex-export-to-pdf][PDF (LaTeX)]] ........ C-c C-e l l - [[help:my-org-article-html-export-to-html][HTML article]] ....... C-c C-e h a [[help:my-org-article-latex-export-to-pdf][PDF article (LaTeX)]] C-c C-e l a + [[help:org-html-export-to-html][HTML]] ............... =C-c= =C-e= =h= =h= [[help:org-latex-export-to-pdf][PDF (LaTeX)]] ........ =C-c= =C-e= =l= =l= + [[help:my-org-article-html-export-to-html][HTML article]] ....... =C-c= =C-e= =h= =a= [[help:my-org-article-latex-export-to-pdf][PDF article (LaTeX)]] =C-c= =C-e= =l= =a= + [[help:my-org-article-html-export-to-html][HTML article (async)]] ........ =F5= [[help:my-org-article-latex-export-to-pdf][PDF article (LaTeX, async)]] .. =F6= *Export LaTeX* [[help:org-latex-remove-logfiles][Logfiles are removed]] (Deactivate for debugging) diff --git a/settings/general-settings.el b/settings/general-settings.el index 097779fa..d8b27ca3 100644 --- a/settings/general-settings.el +++ b/settings/general-settings.el @@ -574,6 +574,7 @@ Version 2016-07-13" ;; https://stackoverflow.com/questions/26638015/elisp-easy-menu-positioning#29396939 ;; add menus to the global menu bar: map nil (use-package easymenu + :after (org) ;; org export async needs org loaded before :config (easy-menu-add-item nil '("File") ["Kill Emacs" kill-emacs :help "Run function `kill-emacs'"] "Quit") @@ -723,10 +724,6 @@ Version 2016-07-13" ;; ["--" 'ignore :visible (featurep 'bookmark+-lit)] ;; conditional separator ;; ["How Many..." how-many] )) - ;; add menus explicitly (required by XEmacs), after easy-menu-define - (easy-menu-add my-major-menu nil) - (easy-menu-add my-lang-menu nil) - (easy-menu-add my-minor-menu nil) (easy-menu-add-item nil () my-menu ;; add empty my menu to menu-bar ;; "Edit" ;; before Edit @@ -744,25 +741,22 @@ Version 2016-07-13" ["Python" my-view-python :help "my-view-python"] ["Shell" my-view-shell :help "my-view-shell"] )) - (easy-menu-add my-view-menu nil) (easy-menu-add-item nil '("My") my-view-menu) (easy-menu-add-item nil '("My") '["Transparency" toggle-transparency :style toggle :selected (transparency-p) :help "toggle-transparency"]) - (with-eval-after-load 'org + (with-eval-after-load 'org ;; org-mode, org-toggle-pretty-entities (easy-menu-define my-org-export-menu nil "My Org Export Menu" '("Org Export" :visible (eq major-mode 'org-mode) - ["Article HTML" my-org-article-html-export-to-html :help "my-org-article-html-export-to-html"] - ["Article PDF" my-org-article-latex-export-to-pdf :help "my-org-article-latex-export-to-pdf"] - ["HTML" my-org-export-html :help "my-org-export-html"] - ["HTML async" my-org-export-html-async :help "my-org-export-html-async"] - ["PDF (LaTeX)" my-org-export-pdf :help "my-org-export-pdf"] - ["PDF (LaTeX) async" my-org-export-pdf-async :help "my-org-export-pdf-async"] + ["Article HTML" my-org-article-html-export-to-html :help "my-org-article-html-export-to-html"] + ["Article HTML async" my-org-article-html-export-to-html-notify-async :help "my-org-article-html-export-to-html-notify-async"] + ["Article PDF" my-org-article-latex-export-to-pdf :help "my-org-article-latex-export-to-pdf"] + ["Article PDF async" my-org-article-latex-export-to-pdf-notify-async :help "my-org-article-latex-export-to-pdf-notify-async"] )) (easy-menu-define my-org-minor-mode-menu nil "My Org Minor Mode Menu" '("Org Minor Mode / Toggles" :visible (eq major-mode 'org-mode) ["Org Fancy Priorities [Ⓟ]" org-fancy-priorities-mode - :style toggle :selected org-sticky-header-mode :help "org-sticky-header-mode"] + :style toggle :selected org-fancy-priorities-mode :help "org-sticky-header-mode"] ["Org Latex Remove Logfiles" (setq org-latex-remove-logfiles (not org-latex-remove-logfiles)) :style toggle :selected org-latex-remove-logfiles :help "org-latex-remove-logfiles"] ["Org Link Descriptive" org-toggle-link-display @@ -778,7 +772,6 @@ Version 2016-07-13" ["Org Table Sticky Header [Ⓣ]" org-table-sticky-header-mode :style toggle :selected org-table-sticky-header-mode :help "org-table-sticky-header-mode"] )) - (easy-menu-add my-org-export-menu nil) (easy-menu-add-item nil '("My") ["---" 'ignore :visible (eq major-mode 'org-mode)]) (easy-menu-add-item nil '("My") my-org-export-menu) (easy-menu-add-item nil '("My") my-org-minor-mode-menu) diff --git a/settings/my-settings.el b/settings/my-settings.el index db0c24f3..e0700ee8 100644 --- a/settings/my-settings.el +++ b/settings/my-settings.el @@ -10,7 +10,86 @@ (use-package my-org-article :load-path (lambda() (concat config-dir "lisp/my")) - :after (org)) + :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 + ""))) + (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 done." + :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 done." + :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 :load-path (lambda() (concat config-dir "lisp/my")) diff --git a/settings/org-settings.el b/settings/org-settings.el index 7860027e..ef7161e7 100644 --- a/settings/org-settings.el +++ b/settings/org-settings.el @@ -249,6 +249,7 @@ Example defines :load-path (lambda () (list (concat config-dir "lisp/org"))) :delight (org-mode "Org") ;; "Org " "\u01F15E" :defer t + :after (ob-csharp) ;;:bind (("C-c " . org-mark-ring-goto)) ;; normally at C-c & but it is redefined by yasnippet :init (setq org-export-backends '(ascii html icalendar latex md odt reveal tufte)) @@ -613,7 +614,7 @@ Updating an old preamble.org should remove this warning.")) :after (org)) (use-package ob-csharp - :after (org org-contrib)) + :after (org-contrib)) (use-package ob-ditaa :defer t @@ -1113,45 +1114,6 @@ Uses function `my-org-headline-string-element'" "maf" ;; minitoc package; list of discardable auxiliary files used by minitoc "mtc0" ;; minitoc package; table of contents for a chapter )) - - (defun my-org-latex-export-to-pdf - (&optional async subtreep visible-only body-only ext-plist) - "Like `org-latex-export-to-pdf' but with additional notification. -And using the rewritten design for an article -`my-org-article-latex-export-to-pdf' (article-latex instead of -latex)." - (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 Latex Export to PDF" - :body "Export done." - :timeout 60000 - :urgency 'normal - :category "transfer")) - output))))) ;; is needed for the asynchronous task - - (defun my-org-export-pdf (&optional async) - (interactive) - (save-buffer) - (when (get-buffer "*gnuplot*") - (kill-buffer "*gnuplot*")) ;; to get a new session - (my-org-latex-export-to-pdf async)) - - (defun my-org-export-pdf-async () - "For async a new emacs session starts using -`org-export-async-init-file'." - ;; TODO: define org-export-async-init-file - (interactive) - (my-org-export-pdf t)) - - (org-defkey org-mode-map [f6] 'my-org-export-pdf) - (org-defkey org-mode-map [C-f6] 'my-org-export-pdf-async) ;; overwrite org ox-latex (defun org-latex--inline-image (link info) @@ -1332,43 +1294,6 @@ used as a communication channel." (use-package ox-tufte ;; https://melpa.org/#/ox-tufte :defer t ;; will be loaded via `org-export-backends' see above inside `org' :config - (defun my-org-tufte-export-to-file (&optional async subtreep visible-only) - "Like `org-tufte-export-to-file' but with additional notification." - (interactive) - (let ((outfile (org-export-output-file-name ".html" 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 - ""))) - (org-export-to-file 'tufte-html outfile - async subtreep visible-only nil nil - (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 Tufte (HTML) Export to File" - :body "Export done." - :timeout 60000 - :urgency 'normal - :category "transfer")) - file))))) ;; is needed for the asynchronous task - - (defun my-org-export-html (&optional async) - (interactive) - (save-buffer) - (when (get-buffer "*gnuplot*") - (kill-buffer "*gnuplot*")) ;; to get a new session - (my-org-tufte-export-to-file async)) - - (defun my-org-export-html-async () - (interactive) - (my-org-export-html t)) - - (org-defkey org-mode-map [f5] 'my-org-export-html) - (org-defkey org-mode-map [C-f5] 'my-org-export-html-async) - (defun org-tufte-src-block (src-block _contents info) "Transcode a SRC-BLOCK element from Org to HTML. CONTENTS holds the contents of the item. INFO is a plist holding