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

Fix README.md #9

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Fix README.md #9

wants to merge 1 commit into from

Conversation

dunmaksim
Copy link

Hello!

I saw README.md and fix some markdown errors.

Also use-package.el documentation says:

  • :init

    Use the :init keyword to execute code before a package is loaded. It accepts one or more forms, up to the next keyword...

  • :config:

    Similarly, :config can be used to execute code after a package is loaded. In cases where loading is done lazily (see more about autoloading below), this execution is deferred until after the autoload occurs.

Summary: you must turn on mode in :config section, not an :init.

@@ -13,11 +12,13 @@ Display icons for filenames in ![Magit](https://github.com/magit/magit) buffers!
</div>

# Preview

Copy link
Author

Choose a reason for hiding this comment

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

Copy link
Owner

Choose a reason for hiding this comment

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

Thanks!

@gekoke
Copy link
Owner

gekoke commented Jun 28, 2024

This actually does work as expected because of the ;;;###autoload cookie prefixed to the minor mode definition. The :init form is run before the package is fully loaded, but the minor mode definition is apparently already in scope when the block runs because of the cookie.

See, for example, Corfu's documentation, which similarly suggests using the :init block.

The reason I suggest using the :init clause is because, although I want the mode to be enabled at startup, I don't want it to be enabled when re-evaluating my config file (possibly overriding the current value for the mode).

For example, with the following config:

(use-package magit-file-icons
  :ensure t
  :after magit
  :config
  (magit-file-icons-mode 1))

If I've disabled the mode at runtime, and now want to evaluate my config file with this form in it, the minor mode will be re-enabled, which is a bit annoying. Using :init avoids this problem.

@gekoke
Copy link
Owner

gekoke commented Jun 28, 2024

Thanks for taking your time to improve the package! If my analysis is mistaken or you would like to add something to the previous, please let me know.

I would still like to accept the formatting changes to the README.

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