From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Oleh Krehel Newsgroups: gmane.emacs.devel Subject: Re: use-package.el -> Emacs core Date: Tue, 10 Nov 2015 08:55:47 +0100 Message-ID: <877flqe1a4.fsf@gmail.com> References: <564136F7.2020404@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1447142156 30309 80.91.229.3 (10 Nov 2015 07:55:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 10 Nov 2015 07:55:56 +0000 (UTC) Cc: emacs-devel@gnu.org To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Nov 10 08:55:51 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Zw3mQ-0006lL-Qw for ged-emacs-devel@m.gmane.org; Tue, 10 Nov 2015 08:55:51 +0100 Original-Received: from localhost ([::1]:57989 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zw3mP-0003AK-Vq for ged-emacs-devel@m.gmane.org; Tue, 10 Nov 2015 02:55:49 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60972) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zw3mN-0003A9-6S for emacs-devel@gnu.org; Tue, 10 Nov 2015 02:55:48 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zw3mJ-0004cr-VH for emacs-devel@gnu.org; Tue, 10 Nov 2015 02:55:47 -0500 Original-Received: from mail-wm0-x22d.google.com ([2a00:1450:400c:c09::22d]:33741) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zw3mJ-0004cj-Nv for emacs-devel@gnu.org; Tue, 10 Nov 2015 02:55:43 -0500 Original-Received: by wmec201 with SMTP id c201so119495993wme.0 for ; Mon, 09 Nov 2015 23:55:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=QTICD0P6dGQ2/6gyMitABjor5XkcZ62E6SZcbMLtAQU=; b=ylrJrshyif/Qxx12Yt79C3IrZFKtAEowf4wAujseqlNI0Ik8rl3kxkaQUVMlGNWMcB BF37F4GgB7LYOCYERvZz6WXqVfwxoARssFpsSrkyobcWsQKeBaVYUPLMhbXT4qPCesvj M4EfjBBVsASE3Y1Ez6XiGWifm9IsblouHotbuGEy6c8QWZrGABp8qQ4RrVYubFqgMegK w90plnkiYz37+AZfPfez25VXvB0fCwJhsEHjE/yMDyFCALbJ23aIwvMa/GuWGr5LUevx +jS9r4w60NwLf93TpHHCujvXHIoWvENftvD2aBbuVP4JPtrze+BQhrblATYJlkbERJII 1F6Q== X-Received: by 10.28.17.135 with SMTP id 129mr33434524wmr.46.1447142143013; Mon, 09 Nov 2015 23:55:43 -0800 (PST) Original-Received: from firefly (dyn069045.nbw.tue.nl. [131.155.69.45]) by smtp.gmail.com with ESMTPSA id bf8sm2032770wjc.22.2015.11.09.23.55.41 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 09 Nov 2015 23:55:42 -0800 (PST) In-Reply-To: (John Wiegley's message of "Mon, 09 Nov 2015 16:31:24 -0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c09::22d X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:193821 Archived-At: John Wiegley writes: > `use-package' is a macro to abstract a common pattern among .emacs files, such > as: > > (add-hook 'foo-init-hook 'some-function) > (add-to-list 'auto-mode-alist '("\\.foo$" . foo-mode)) > (eval-after-load "foo-mode" > '(progn > (define-key foo-mode-map (kbd "C-c k") 'foo-hello))) > > It abstracts the common cases I encountered in my use of 100+ Emacs packages, > and macroexpands to code that tries to minimize Emacs load time as much as > possible. It also adds features that would be cumbersome to do manually, such > as optionally installing an idle-timer so a package is always loaded if Emacs > has been idle for X seconds. > > (use-package foo-mode > :mode "\\.foo$" > :bind (:map foo-mode-map > ("C-c k" . foo-hello)) > :init (add-hook 'foo-init-hook 'some-function)) I have some reservations for this. While I use use-package, I started with it long after learning basic Elisp. Essentially, use-package is a black box that abstracts and creates new syntax. Which is fine for veteran users, since they have an idea of what it does. But I think it might be detrimental to new Elisp users. Using the first method, they learn what `add-hook' is, what `add-to-list' is, what keymaps are etc. These things are useful in all kinds of places, not just in the context of setting up packages. Concerning bind-key: if the functionality is useful, it should be merged into `define-key', instead of adding yet another syntax for the same thing. One more concern that I see is the stability of use-package API. I wouldn't want to add logic to my config to disable the built-in use-package and install the new version to use a new feature. This was the case for CEDET for a long time, and it was a headache. Having said all that, I'm against adding use-package to the core. It would add potential headache without adding utility, since I don't see any code in the core benefiting from re-using use-package. I am for augmenting `define-key' with `bind-key' features, though.