abougouffa / minemacs

MinEmacs: an Emacs configuration framework for daily use
https://abougouffa.github.io/minemacs/
MIT License
140 stars 17 forks source link

[BUG] plantUML - export with Org #121

Closed raylemon closed 10 months ago

raylemon commented 10 months ago

After installing plantuml-mode, I want to export some plantuml code in an org-mode file to pdf latex. I didn’t know if plantuml is correctly configured.

(use-package plantuml-mode
  :init
  (setq plantuml-jar-path "~/.emacs.d/local/plantuml/plantuml.jar")
  (setq plantuml-default-exec-mode 'jar)
  (setq org-plantuml-jar-path (expand-file-name "~/.emacs.d/local/plantuml/plantuml.jar"))
  (add-to-list 'org-src-lang-modes '("plantuml" . plantuml))
  (org-babel-do-load-languages 'org-babel-load-languages '((plantuml . t))))

(use-package flycheck-plantuml
  :commands
  (flycheck-plantuml-setup))

When I want to export my org file, process will stop with this backtrace

Using MinEmacs' "me-org-export-async-init.el" as init file.
[DISCLAIMER]: MINEMACS HAS NOT BEEN TESTED ON WINDOWS, YOU SHOULD INVESTIGATE THE ISSUES YOU FACE!
Loading "init.el" in an org-export-async context.

`epa-file' enabled

Loading c:/Users/big04/.emacs.d/local/recentf-save.el (source)...
Cleaning up the recentf list...
Cleaning up the recentf list...done (0 removed)

Building citar...
Building citar -> Building parsebib...
Building citar -> Building parsebib...done
Building citar -> Building citeproc...
Building citar -> Building citeproc -> Building queue...
Building citar -> Building citeproc -> Building queue...done
Building citar -> Building citeproc -> Building string-inflection...
Building citar -> Building citeproc -> Building string-inflection...done
Building citar -> Building citeproc...
Building citar -> Building citeproc...done
Building citar...
Building citar...done
Building citar-embark...
Building citar-embark...done

Error: void-variable (org-src-lang-modes)
  mapbacktrace(#f(compiled-function (evald func args flags) #<bytecode -0x1d15372cab9119b2>))
  debug-early-backtrace()
  debug-early(error (void-variable org-src-lang-modes))
  (member '("plantuml" . plantuml) org-src-lang-modes)
  (if (member '("plantuml" . plantuml) org-src-lang-modes) org-src-lang-modes (setq org-src-lang-modes (cons '("plantuml" . plantuml) org-src-lang-modes)))
  load-with-code-conversion("c:/Users/big04/.minemacs.d/config.el" "c:/Users/big04/.minemacs.d/config.el" nil t)
  load("c:/Users/big04/.minemacs.d/config.el" nil t)
  (if (file-exists-p filename) (load filename nil (not minemacs-verbose)) (message "[MinEmacs:Error] Cannot load \"%s\", the file doesn't exists." filename))
  (let ((filename (file-truename (apply #'concat filename-parts)))) (if (file-exists-p filename) (load filename nil (not minemacs-verbose)) (message "[MinEmacs:Error] Cannot load \"%s\", the file doesn't exists." filename)))
  +load("~/.minemacs.d/config.el")
  (progn (+load user-config))
  (if (file-exists-p user-config) (progn (+load user-config)))
  (let ((user-config (concat minemacs-config-dir "config.el"))) (if (file-exists-p user-config) (progn (+load user-config))))
  (if (memq 'config minemacs-ignore-user-config) nil (let ((user-config (concat minemacs-config-dir "config.el"))) (if (file-exists-p user-config) (progn (+load user-config)))))
  load-with-code-conversion("c:/Users/big04/.emacs.d/init.el" "c:/Users/big04/.emacs.d/init.el" nil t)
  load("~/.emacs.d/init.el" nil t)
  load-with-code-conversion("c:/Users/big04/.emacs.d/modules/extras/me-org-export-async-init.el" "c:/Users/big04/.emacs.d/modules/extras/me-org-export-async-init.el" nil t)
  command-line-1(("-l" "c:/Users/big04/.emacs.d/modules/extras/me-org-export-async-init.el" "-l" "c:/Users/big04/AppData/Local/Temp/org-export-process7OsSkN"))
  command-line()
  normal-top-level()
Symbol's value as variable is void: org-src-lang-modes

I have followed this install guide: [https://github.com/skuro/plantuml-mode]

Emacs version Emacs 29.1 (Windows)

How can I do that ?

abougouffa commented 10 months ago

PlantUML is already provided by MinEmacs in me-data and the PlantUML integration with Org mode is supported by Org out of the box and customization is tweaked in the me-builtin module.

Despite the fact that you can use directly the configuration provided by MinEmacs in me-data. The issue in your case is caused by your config.el. As you see at the end, Symbol's value as variable is void: org-src-lang-modes. You need to set (add-to-list 'org-src-lang-modes '("plantuml" . plantuml)) after checking if org-src has been loaded or not:

(with-eval-after-load 'org-src
  (add-to-list 'org-src-lang-modes '("plantuml" . plantuml)))