help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: using use-package


From: Stefan Monnier
Subject: Re: using use-package
Date: Tue, 28 Jun 2016 18:05:37 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

>> Well I would have thought that needing eval-after-load and relatives
>> is evidence of a badly written (in Stefan's sense) package

I do think it's a problem, but admittedly, the way keymaps are normally
setup there's no standard&easy way for the package to "do the right thing".

IOW it's a failure of the general infrastructure offered by Emacs to
define and modify keymaps.  I'd encourage anyone to try and come up with
a good solution to this problem (it'll probably require changing "all"
packages to use a new way to declare keymaps, but I think it's a price
worth paying).

>> For myself (as you seem to say) if use-package reduces all that
>> imperative gunk I guess I'll use it

As for me, I don't think

    (global-set-key (kbd "C-x C-b") 'electric-buffer-list)
    (with-eval-after-load 'buff-menu
      (define-key electric-buffer-menu-mode-map
                  (kbd "X") 'save-buffers-kill-emacs))

is really worse than

    (use-package ebuff-menu
      :bind (("C-x C-b" . electric-buffer-list)
             :map electric-buffer-menu-mode-map
             ("X" . save-buffers-kill-emacs)))

especially if you consider that the former uses functions and syntax
which is used throughout Emacs, whereas the latter uses a syntax that's
defined in an ad-hoc manner for use-package and isn't used elsewhere.

It's also unclear how/why one of the bindings is available immediately
while the other is only activated later (i.e. there's a bit too much
ad-hoc magic for my taste).  If the "X" binding could be auto-activated
when the electric-buffer-menu-mode-map keymap is defined it would be
much better but that would require getting away from using
eval-after-load internally.


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]