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 a patch #45

Closed
haji-ali opened this issue May 17, 2020 · 4 comments
Closed

Autoloading a patch #45

haji-ali opened this issue May 17, 2020 · 4 comments

Comments

@haji-ali
Copy link
Contributor

Is there a way to define a patch, have it disabled by default and load the patch only when it is enabled for the first time?
In other words, I would like to be able to "autoload" the patch just like my functions are "autoloaded".

@raxod502
Copy link
Member

You can use with-eval-after-load or use-package, as outlined in the README. Do either of those work for you?

@haji-ali
Copy link
Contributor Author

Thanks. As far as I understood from the readme, the method outlined there defines and enables a patch as soon as the package is loaded, isn't that correct?

I am looking for a way to define a patch with an autoload directive (just like a function is defined with ;;;###autoload comment). Then at some point, I want to enable that patch which would then evaluate it.

The scenario I have is that I have many patches for many packages. I want to define those patches and enable them selectively later on. Also, I autoload my function definitions to speed up my startup time, so I want my patches to be similarly autloaded.

I am sorry if my explanation is clumsy, I am not expert in package management/emacs loading so I might be misunderstanding something or confusing fundamental issues.

@raxod502
Copy link
Member

When you autoload a function, it just means that calling the function loads the package, at which point every function in the package is defined. That's the same as what happens with el-patch in the scenario I described. Emacs does not have a concept of autoloading anything more granular than a package.

@haji-ali
Copy link
Contributor Author

Oh I see. That makes sense.

I also now understand that el-patch does not have a patch management system (where patches can be enabled/disabled). So I will have to call el-patch-defun and el-patch-unpatch to add/remove patches accordingly.

Thanks for explaining.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants