Skip to content

Bug Fix: emacs html export #199

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 17, 2022
Merged

Conversation

aareman
Copy link
Contributor

@aareman aareman commented Jan 7, 2022

emacs html export requires the htmlize package which is no longer included in the latest orgmode for emacs (I'm using emacs 26.3). If you export to html -> emacs with a code block it breaks since it uses htmlize to syntax highlight. (btw, get the same error in emacs when trying to export)

That being said, when I install the htmlize package in emacs, exporting from emacs works, but still fails from orgmode.nvim. The reason is because the --batch flag doesn't source your emacs configuration and any packages you have. This PR adds a --load switch to the export command that points at your emacs config. This tells emacs running in batch mode to load a specific startup file, in this case the main emacs config.

NOTE Changes beyond this. We may want to have a config option for specifying the location of an emacs config to use, since its not standard on all systems.

I know its failing tests/formatting. Just want to make sure this is an acceptable fix before polishing this PR. (See NOTE above for one outstanding issue)

@kristijanhusak
Copy link
Member

Didn't know about that, thanks. I guess this should also fix #87.
Only issue that I see with this is that it's hardcoded. People may be using different path like $HOME/.emacs for example.
Lets do this:

  • Introduce a property emacs_config in the config/defaults.lua file that should look something like this:
emacs_config = {
  executable_path = 'emacs',
  config_path = '$HOME/.emacs.d/init.el`
}
  • Use the above config in the exporter

That should solve everything, and make it configurable.

@aareman
Copy link
Contributor Author

aareman commented Jan 14, 2022

@kristijanhusak I've made the updates and fixed the formatting issues. I also added basic documentation for it in the DOC.md file, Is there anywhere else I should put it?

@kristijanhusak
Copy link
Member

@aareman looks ok, just address that one comment, and please squash commits into a single one. Thanks.

This fixes a bug where just calling "--batch" does not source your
config. This commit hardcodes to "~/.emacs.d/init.el" which really
should be dynamic in settings/config. Just not sure how to do that.
@aareman
Copy link
Contributor Author

aareman commented Jan 17, 2022

I made the changes, and squashed the commits.

@kristijanhusak kristijanhusak merged commit 6843e37 into nvim-orgmode:master Jan 17, 2022
@kristijanhusak
Copy link
Member

Awesome, thanks!

gzagatti pushed a commit to gzagatti/orgmode that referenced this pull request Oct 19, 2022
SlayerOfTheBad pushed a commit to SlayerOfTheBad/orgmode that referenced this pull request Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants