Skip to content
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

Autoloading #8

Open
contrapunctus-1 opened this issue Feb 22, 2021 · 5 comments
Open

Autoloading #8

contrapunctus-1 opened this issue Feb 22, 2021 · 5 comments

Comments

@contrapunctus-1
Copy link
Contributor

How would one lazy load using literate-elisp? I tried (autoload 'foo "/path/to/foo.org"), but got eval-buffer: Invalid read syntax: #

On a related note, could you please implement a literate-elisp extension for use-package? Perhaps as a new keyword, or ideally transparently detecting an Org file and preferring to load that.

@jingtaozf
Copy link
Owner

Thanks for your suggestions.

A patch is welcome and I will do it when available.

@contrapunctus-1
Copy link
Contributor Author

A possible solution is to create an Elisp file to literate-elisp-load the Org file -

(require 'literate-elisp)

(literate-elisp-load (format "%sfoo.org" (file-name-directory load-file-name)))

(provide 'foo)

Now one can use use-package as usual - (use-package foo :commands (foo-connect) ...)

@contrapunctus-1
Copy link
Contributor Author

Okay, so that works for use-package users, but only because of its autoload creation behavior (:commands and friends). Everyone else has to define their own autoloads, even if the author added autoload cookies in the literate program - because generate-file-autoloads / update-file-autoloads , as run by package.el after installation, do not work for literate programs.

Is there anything literate-elisp can do about this? In the current situation, in the interests of users, I'm opting to switch to a tangling-based setup...which is sad, as I much preferred literate-elisp. 😔

@jingtaozf
Copy link
Owner

Maybe we can create an interactive command literate-autoload to load the org source file.

@jingtaozf
Copy link
Owner

I have added a commit to support autoload to org file.
https://github.com/jingtaozf/literate-elisp/blob/master/literate-elisp.org#add-advice-to-emacs-native-load-function

Can you have a test of it, and if all is fine I'll close this issue.
Thanks.

tarsius pushed a commit to emacsmirror/jabber that referenced this issue Jun 20, 2022
literate-elisp-load is great, but currently suffers from issues with
lexical scope [1] and autoload generation [2]. :(

[1] jingtaozf/literate-elisp#6
[2] jingtaozf/literate-elisp#8
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

No branches or pull requests

2 participants