From 043a0ed3a8391009753e60ee79b894df29fba1cb Mon Sep 17 00:00:00 2001 From: Daniel Weschke Date: Mon, 23 Jun 2025 17:11:29 +0200 Subject: [PATCH] org load order --- scripts/test/test.org | 18 ++++++--- settings/org-settings.el | 73 ++++++++++++++++++++++++++----------- settings/plot-settings.el | 4 +- settings/python-settings.el | 8 +++- 4 files changed, 74 insertions(+), 29 deletions(-) diff --git a/scripts/test/test.org b/scripts/test/test.org index 71cac32e..f76e8c73 100644 --- a/scripts/test/test.org +++ b/scripts/test/test.org @@ -1,7 +1,9 @@ -* syntax highlighting +* scr block -** graphviz dot +** syntax highlighting + +*** graphviz dot #+begin_src dot digraph G { main -> parse -> execute; @@ -15,7 +17,7 @@ digraph G { } #+end_src -** gnuplot +*** gnuplot #+begin_src gnuplot :results silent reset @@ -38,9 +40,9 @@ plot f(x) w lp lw 1, g(x) w p lw 2, h(x) w l lw 3 #+end_src -* custom header +** custom header -** python +*** python - interactive inside org - html export creates a svg file @@ -63,3 +65,9 @@ ax.set_xlabel('Electrical current, A') ax.set_ylabel('Temperature, °C') ax.set_title('Characteristic curve of the peltier element') #+end_src + +* latex + +=org-startup-with-latex-preview= + +\(a=5\) diff --git a/settings/org-settings.el b/settings/org-settings.el index 87fa004b..0b3eacbe 100644 --- a/settings/org-settings.el +++ b/settings/org-settings.el @@ -246,13 +246,43 @@ Example defines ;; be loaded before, otherwise both versions will be loaded and will ;; conflict. (use-package org + :commands org-mode :delight (org-mode "Org") ;; "Org " "\u01F15E" - :defer t ;;:bind (("C-c " . org-mark-ring-goto)) ;; normally at C-c & but it is redefined by yasnippet :init ;; (require 'org-loaddefs) (setq org-export-backends '(ascii html icalendar latex md odt reveal tufte)) :config + (setq org-preview-latex-process-alist + '((dvipng :programs + ("latex" "dvipng") + :description "dvi > png" :message "you need to install the programs: latex and dvipng." :image-input-type "dvi" :image-output-type "png" :image-size-adjust + (1.1 . 1.0) + :latex-compiler + ("dvilualatex -interaction nonstopmode -output-directory %o %f") + :image-converter + ("dvipng -D %D -T tight -bg Transparent -o %O %f")) + (dvisvgm :programs + ("latex" "dvisvgm") + :description "dvi > svg (use-pacakge setq)" :message "you need to install the programs: latex and dvisvgm." :image-input-type "dvi" :image-output-type "svg" :image-size-adjust + (1.7 . 1.5) + :latex-compiler + ("latex -interaction nonstopmode -output-directory %o %f") + :image-converter + ("dvisvgm %o%b -n -b min -c %S -o %O") + ;; ("dvisvgm %f -n -b min -c %S -o %O") + ;; Creating LaTeX preview... + ;; ERROR: can't open file '../../../../../../../tmp/orgtexvseQuS.dvi' for reading + ;; NB: %o%b.dvi instead of %f forces use of absolute path + ) + (imagemagick :programs + ("latex" "convert") + :description "pdf > png" :message "you need to install the programs: latex and imagemagick." :image-input-type "pdf" :image-output-type "png" :image-size-adjust + (1.0 . 1.0) + :latex-compiler + ("lualatex -interaction nonstopmode -output-directory %o %f") + :image-converter + ("convert -density %D -trim -antialias %f -quality 100 %O")))) (setq org-hidden-keywords '(author date title email subtitle)) ;; see also `org-appear' (setq org-hide-emphasis-markers t) ;; see also `org-appear' (setq org-startup-folded nil) ;; nil = showall = #+STARTUP: showall @@ -261,7 +291,7 @@ Example defines (setq org-pretty-entities nil) ;; so much trouble in an article, see also `org-appear' and [C-c C-x \] (`org-toggle-pretty-entities') (setq org-pretty-entities-include-sub-superscripts t) ;; if `org-pretty-entities' is active include also sub-superscripts. (setq org-image-actual-width '(600)) ;; image width displayed in org - (setq org-startup-with-latex-preview t) ;; #+STARTUP: latexpreview|nolatexpreview + (setq org-startup-with-latex-preview nil) ;; #+STARTUP: latexpreview|nolatexpreview ;; scale of latex image preview via `org-format-latex-options'. setting this here will overwrite settings in custom.el. ;; see also `org-preview-latex-process-alist', `org-preview-latex-default-process' and `org-format-latex-header' using `org-latex-default-packages-alist' and `org-latex-packages-alist' (add-to-list 'org-latex-default-packages-alist '("" "eurosym" t) t) ;; add \euro{} (also to latex snippets) @@ -290,19 +320,13 @@ Example defines (awk . t) (C . t) (calc . t) - (csharp . t) - (ditaa . t) (dot . t) - (ein . t) (emacs-lisp . t) - (gnuplot . t) (haskell . t) (js . t) - (jupyter .t) + (jupyter . t) (latex . t) (octave . t) - (plantuml . t) - (python . t) (R . t) ;; Error message regarding R: ;; (invalid-function org-babel-header-args-safe-fn) @@ -324,7 +348,6 @@ Example defines ;; (require 'org-contrib-autoloads) (use-package org-contrib ;; :defer t - :after (org) ;; :init ;; (require 'org-contrib-autoloads) ) @@ -431,7 +454,7 @@ Suggest the URL title as a description for resource." ;; see also org-cliplink K, org-brain b (use-package org-cliplink - :after (org) + :commands (org-cliplink org-cliplink-capture) :config (defun my-org-link-description-update () "." @@ -460,7 +483,9 @@ Suggest the URL title as a description for resource." "* TODO %(org-cliplink-capture) \n SCHEDULED: %t\n" :empty-lines 0)))) (use-package org-collector ;; collect properties into tables, using #+BEGIN: propview - :after (org)) + ;; org-contrib + :defer 0.1 + :after org-table) (use-package org-drill ;; requires persist https://elpa.gnu.org/packages/persist.html :commands org-drill) @@ -477,7 +502,7 @@ Suggest the URL title as a description for resource." ("CANCELED" . (:foreground "blue" :weight bold))))) (use-package org-fancy-priorities - :after (org) + :commands org-fancy-priorities-mode :delight (org-fancy-priorities-mode "Fp") ;; FancyPriorities "\u24C5" :hook (org-mode . org-fancy-priorities-mode) :config @@ -533,7 +558,6 @@ Suggest the URL title as a description for resource." :after (org)) (use-package org-num ;; numbering of headings - :after (org) :commands (org-num-mode) :delight (org-num-mode "#") ;; o# "\uFF03" :config @@ -598,7 +622,7 @@ Suggest the URL title as a description for resource." ) (use-package org-sticky-header - :after (org org-table-sticky-header) ;; org-table-sticky-header-mode must be set before + :after (org-table-sticky-header) ;; org-table-sticky-header-mode must be set before :hook (org-mode . org-sticky-header-mode) :config ;;(setq org-sticky-header-always-show-header nil) @@ -644,7 +668,6 @@ Suggest the URL title as a description for resource." (setq org-table-convert-region-max-lines 9999)) (use-package org-table-sticky-header - :after (org) :delight (org-table-sticky-header-mode "Tsh") ;; \u24C4t OTSH "\u24C9" :hook (org-mode . org-table-sticky-header-mode)) ;; must be set before org-sticky-header-mode, maybe orgtbl-show-header can also be used @@ -695,7 +718,9 @@ Updating an old preamble.org should remove this warning.")) (use-package ob-csharp :defer t - :after (org-contrib)) + :config + (with-eval-after-load 'org + (add-to-list 'org-babel-load-languages '(csharp . t)))) (use-package ob-ditaa :defer t @@ -709,10 +734,14 @@ Updating an old preamble.org should remove this warning.")) ;; org-ditaa-jar-option "" ; default is "-jar". set to "" because system ditaa executable includes -jar ;; org-ditaa-jar-path (concat "" (executable-find "ditaa")) ;; TODO: find file e.g. (shell-command "cat `which ditaa`") or (shell-command "ls /usr/share/java/ditaa") - (setq org-ditaa-jar-path "/usr/share/java/ditaa/ditaa-0.11.jar")) + (setq org-ditaa-jar-path "/usr/share/java/ditaa/ditaa-0.11.jar") + (with-eval-after-load 'org + (add-to-list 'org-babel-load-languages '(ditaa . t)))) (use-package ob-gnuplot - :defer t + :init + (with-eval-after-load 'org + (add-to-list 'org-babel-load-languages '(gnuplot . t))) :config ;; gnuplot config for own org export projects, used in preamble (defvar gnuplot-init-light "reset ; \ @@ -963,9 +992,9 @@ usage: #+HEADER: :results (tpl-results) :after (org-src python) ;; :commands (org-babel-execute:python ;; org-babel-variable-assignments:python) - ;; :init - ;; (with-eval-after-load 'org - ;; (add-to-list 'org-babel-load-languages '(python . t))) + :init + (with-eval-after-load 'org + (add-to-list 'org-babel-load-languages '(python . t))) :config (defun mpl-var (filename) "\ diff --git a/settings/plot-settings.el b/settings/plot-settings.el index 34337ce1..22377477 100644 --- a/settings/plot-settings.el +++ b/settings/plot-settings.el @@ -38,7 +38,9 @@ :config ;; arch linux aur package path (setq plantuml-jar-path "/usr/share/java/plantuml/plantuml.jar") - (setq org-plantuml-jar-path "/usr/share/java/plantuml/plantuml.jar")) + (setq org-plantuml-jar-path "/usr/share/java/plantuml/plantuml.jar") + (with-eval-after-load 'org + (add-to-list 'org-babel-load-languages '(plantuml . t)))) (provide 'plot-settings) ;;; plot-settings.el ends here diff --git a/settings/python-settings.el b/settings/python-settings.el index f6a6927d..a37319ef 100644 --- a/settings/python-settings.el +++ b/settings/python-settings.el @@ -212,10 +212,16 @@ process." ;; requires: anaphora dash deferred polymode request websocket with-editor (use-package ein :commands (ein:run ein:jupyter-server-start ein:notebooklist-open) + :init :config (require 'ein-jupyter) (require 'ein-notebook) - (setq ein:output-area-inlined-images t)) + (setq ein:output-area-inlined-images t) + ;; ob-ein + (with-eval-after-load 'org + (add-to-list 'org-babel-load-languages '(ein . t))) + ;; also `org-babel-load-languages' ? + ) (provide 'python-settings) ;;; python-settings.el ends here