Skip to content

Conversation

@Shizcow
Copy link

@Shizcow Shizcow commented Nov 28, 2021

The following allows for loading this package via quelpa directly from .emacs as follows:

(use-package glsl-mode)
(use-package ob-glsl
  :after glsl-mode
  :quelpa (ob-glsl
		   :fetcher github
		   :repo "finalpatch/ob-glsl"
		   :files ("*.el" "*.cpp" "*.hpp" "CMakeLists.txt" "*.h" "*.so"))
  :custom
  (org-babel-do-load-languages
   'org-babel-load-languages
   '((glsl . t))))

Obviously, replace "finalpatch/ob-glsl" with "shizcow/ob-glsl" for a working example.

Being able to load this package with quelpa makes it one step closer to being melpa-compatible and able to be loaded with a simple (use-package ob-glsl).

Note on cleanliness

I'm not particularly versed in writing emacs packages, so I probable made some big mistakes here. The provided changes aren't really intended as a final product, but as a push towards the eventual goal of making this package more accessible.

@finalpatch
Copy link
Owner

Thanks. I'll look into this when I have some free time.

Copy link
Owner

@finalpatch finalpatch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried this on Windows and it works really well. I'm not sure what's the best way to manage binary dependencies though. The compilation command wouldn't work if the required build tools and libraries are not installed on the user's system.

Consider automatically pulling the file output type from ninja -- more compatibility?

Co-authored-by: finalpatch <[email protected]>
Comment on lines +18 to +19
(when (not (featurep 'ob-glsl-module))
(ob-glsl-compile))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: does this mean this code will always attempt to compile if the module is not yet loaded, even when it's already compiled and available?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in order to minimize the loading latency, we would only want to run the compilation when the dynamic module is not available (or better, check if it is out of date).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good points here. Are there any well established references for automatically compiling modules? Vterm detects when its module is out of date (I haven't looked into the implementation), but doesn't do so automatically.

If lazy loading is done properly, then this may be enough. It'd help with debugging problems in compilation (eg a dependency isn't installed).

I don't know of any emacs packages with modules that automatically compile on install/load, but I haven't exactly looked too much.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: does this mean this code will always attempt to compile if the module is not yet loaded, even when it's already compiled and available?

Yes.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just perform a quick check of the existence of the dynamic module, or just attempt to load it, and only run the compilation when the file does not already exist or failed to load?

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