conao3 / feather.el

Parallel thread modern Emacs package manager
GNU General Public License v3.0
94 stars 2 forks source link

Already installed packages with `:feather t` keyword are not loaded #11

Open fernandodemorais-jf opened 3 years ago

fernandodemorais-jf commented 3 years ago

Hello,

Considering the following snippet as an example:

(leaf feather
  :ensure t
  :blackout (feather-mode . nil)
  :global-minor-mode feather-mode)

(leaf zerodark-theme
  :feather t
  :setq ((zerodark-use-paddings-in-mode-line . nil))
  :config (load-theme 'zerodark t))

When I include this snippet in my init.el and run Emacs with it, if the theme is not installed, feather is able to install zerodark-theme and the package is loaded as intended.

However, if I restart Emacs zerodark-theme is no longer loaded. I need to comment :feather t line and restart Emacs, or evaluate the theme block to load it.

Maybe I missed some fether (or even leaf) configuration?

Thanks!

conao3 commented 3 years ago

Please try this init.el Sorry, current README is outdated and I must update it.

fernandodemorais-jf commented 3 years ago

Hello @conao3!

I tried the init.el that you've suggested, and the behavior was the same: if the :ensure t keyword (following the feather configuration block, after setting ((leaf-alias-keyword-alist . '((:ensure . :feather))))) is in the leaf block of a package, it will be installed and loaded the first time you start Emacs, but if you restart the package will not load.

Oddly enough, if I write the following in the init.el:

(leaf feather
  :ensure t
  :custom ((leaf-alias-keyword-alist . '((:ensure . :feather))))
  :config (feather-mode))

(leaf zerodark-theme :ensure t)
(leaf zerodark-theme
  :setq ((zerodark-use-paddings-in-mode-line . nil))
  :config (load-theme 'zerodark t))

zerodark-theme will be installed, but not loaded, because leaf will raise a warning (informing that the package is not installed) and restarting Emacs will load the theme as expected. :sweat_smile:

But, even if there is this workaround to use feather with leaf, there would be no other way to use :ensure t or :feather t inside a leaf configuration block, without the need to replicate it just to (leaf <package-name> :ensure t)?

Thanks!

P.S.: by the way, leaf-manager is an awesome package! :smiley:

alekfed commented 3 years ago

I have the same issue, configuration from aforementioned init.el didn't help to solve it.

Perhaps, it's not a problem of feather.el itself and this problem has something to do with recent leaf-keywords.el activity, because :ensure keyword works fine without alias ((leaf-alias-keyword-alist . '((:ensure . :feather)))), but :feather keyword doesn't work at all even without alias.

fernandodemorais-jf commented 3 years ago

Hello @conao3!

After some investigation, based on @alekfed comment, I managed to find a solution to this issue.

In fact, the source of the issue is precisely in the :feather keyword in leaf-keywords.el code.

The list generated by the feather-add-after-installed-hook-sexp macro was not being evaluated, so I just added an eval to line 104 of the leaf-keywords.el package:

(leaf-list
   :feather    `(,@(mapcar (lambda (elm) `(leaf-handler-package ,leaf--name ,(car elm) ,(cdr elm))) leaf--value)
                 (eval (feather-add-after-installed-hook-sexp ,(caar (last leaf--value)) ,@leaf--body))) ; <-- Here.

I don't know if its the best solution, but it manages to solve the problem and now already installed packages are loaded, even with the :feather keyword!

Thanks!

conao3 commented 3 years ago

Thanks, PR welcome!

fernandodemorais-jf commented 3 years ago

Thanks, PR welcome!

Done! :handshake: