gekoke / magit-file-icons

File icons for Magit
GNU General Public License v3.0
30 stars 6 forks source link

Fix README.md #9

Open dunmaksim opened 2 months ago

dunmaksim commented 2 months ago

Hello!

I saw README.md and fix some markdown errors.

Also use-package.el documentation says:

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

gekoke commented 2 months ago

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 commented 2 months ago

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.